diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-04 19:34:58 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-04 19:34:58 +0000 |
commit | b86a748b1d3a41fa328e4e1f61cdf1acee8137f6 (patch) | |
tree | aa4c4b166dffaf8793419072d5be08e029a9d491 /app/views | |
parent | daa426167f2ce2cb9e044d340ed4ba42cfe599f6 (diff) | |
download | redmine-b86a748b1d3a41fa328e4e1f61cdf1acee8137f6.tar.gz redmine-b86a748b1d3a41fa328e4e1f61cdf1acee8137f6.zip |
Adds REST API for versions (#7403).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6180 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/settings/_versions.rhtml | 6 | ||||
-rw-r--r-- | app/views/versions/index.api.rsb | 18 | ||||
-rw-r--r-- | app/views/versions/show.api.rsb | 14 | ||||
-rw-r--r-- | app/views/versions/show.rhtml | 6 |
4 files changed, 38 insertions, 6 deletions
diff --git a/app/views/projects/settings/_versions.rhtml b/app/views/projects/settings/_versions.rhtml index f9a4dd109..f00fe5bd2 100644 --- a/app/views/projects/settings/_versions.rhtml +++ b/app/views/projects/settings/_versions.rhtml @@ -19,9 +19,9 @@ <td class="sharing"><%=h format_version_sharing(version.sharing) %></td> <td><%= link_to_if_authorized(h(version.wiki_page_title), {:controller => 'wiki', :action => 'show', :project_id => version.project, :id => Wiki.titleize(version.wiki_page_title)}) || h(version.wiki_page_title) unless version.wiki_page_title.blank? || version.project.wiki.nil? %></td> <td class="buttons"> - <% if version.project == @project %> - <%= link_to_if_authorized l(:button_edit), {:controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %> - <%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %> + <% if version.project == @project && User.current.allowed_to?(:manage_versions, @project) %> + <%= link_to l(:button_edit), edit_project_version_path(@project, version), :class => 'icon icon-edit' %> + <%= link_to l(:button_delete), project_version_path(@project, version), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %> <% end %> </td> </tr> diff --git a/app/views/versions/index.api.rsb b/app/views/versions/index.api.rsb new file mode 100644 index 000000000..cf00e1a75 --- /dev/null +++ b/app/views/versions/index.api.rsb @@ -0,0 +1,18 @@ +api.array :versions, api_meta(:total_count => @versions.size) do + @versions.each do |version| + api.version do + api.id version.id + api.project(:id => version.project_id, :name => version.project.name) unless version.project.nil? + + api.name version.name + api.description version.description + api.status version.status + api.due_date version.effective_date + + render_api_custom_values version.custom_field_values, api + + api.created_on version.created_on + api.updated_on version.updated_on + end + end +end diff --git a/app/views/versions/show.api.rsb b/app/views/versions/show.api.rsb new file mode 100644 index 000000000..e52c52eb1 --- /dev/null +++ b/app/views/versions/show.api.rsb @@ -0,0 +1,14 @@ +api.version do + api.id @version.id + api.project(:id => @version.project_id, :name => @version.project.name) unless @version.project.nil? + + api.name @version.name + api.description @version.description + api.status @version.status + api.due_date @version.effective_date + + render_api_custom_values @version.custom_field_values, api + + api.created_on @version.created_on + api.updated_on @version.updated_on +end diff --git a/app/views/versions/show.rhtml b/app/views/versions/show.rhtml index 5fcdf8b82..72ae80218 100644 --- a/app/views/versions/show.rhtml +++ b/app/views/versions/show.rhtml @@ -1,8 +1,8 @@ <div class="contextual"> -<%= link_to_if_authorized l(:button_edit), {:controller => 'versions', :action => 'edit', :id => @version}, :class => 'icon icon-edit' %> +<%= link_to(l(:button_edit), edit_project_version_path(@version.project, @version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %> <%= link_to_if_authorized(l(:button_edit_associated_wikipage, :page_title => @version.wiki_page_title), {:controller => 'wiki', :action => 'edit', :project_id => @version.project, :id => Wiki.titleize(@version.wiki_page_title)}, :class => 'icon icon-edit') unless @version.wiki_page_title.blank? || @version.project.wiki.nil? %> -<%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => @version, :back_url => url_for(:controller => 'versions', :action => 'index', :project_id => @version.project)}, - :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %> +<%= link_to(l(:button_delete), project_version_path(@version.project, @version, :back_url => url_for(:controller => 'versions', :action => 'index', :project_id => @version.project)), + :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del') if User.current.allowed_to?(:manage_versions, @version.project) %> <%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %> </div> |