From 54e65ac8696ec8aa696bdb09f064f703c7114ef2 Mon Sep 17 00:00:00 2001 From: Florian Kraft Date: Tue, 19 May 2015 10:47:56 +0200 Subject: [PATCH 1/2] use toolbar throughout plugin Signed-off-by: Florian Kraft --- app/views/meeting_contents/diff.html.erb | 17 ++++----- app/views/meeting_contents/history.html.erb | 2 +- app/views/meetings/edit.html.erb | 2 +- app/views/meetings/index.html.erb | 3 +- app/views/meetings/new.html.erb | 3 +- app/views/meetings/show.html.erb | 38 ++++++++++++++++----- 6 files changed, 43 insertions(+), 22 deletions(-) diff --git a/app/views/meeting_contents/diff.html.erb b/app/views/meeting_contents/diff.html.erb index d8e2a241d0..0ba195aa4a 100644 --- a/app/views/meeting_contents/diff.html.erb +++ b/app/views/meeting_contents/diff.html.erb @@ -19,15 +19,16 @@ See doc/COPYRIGHT.md for more details. ++#%> -<% content_for :action_menu_specific do %> - <%= link_to_if_authorized(l(:label_history), {:controller => '/' + @content_type.pluralize, :action => 'history', :meeting_id => @meeting}, :class => 'icon icon-wiki') %> -<% end %> - <% html_title "#{l(:label_meeting_diff)}: #{@meeting.title}" %> - -

<%= l(:"label_#{@content_type}") %>: <%= link_to @meeting, @meeting %>

- -<%= render :partial => 'layouts/action_menu_specific' %> +<%= toolbar title: "#{l(:"label_#{@content_type}")}: #{link_to @meeting, @meeting}" do %> + <% if authorize_for(@content_type.pluralize, :history) %> +
  • + <%= link_to({controller: "/#{@content_type.pluralize}", action: 'history', meeting_id: @meeting }, class: 'button') do %> + <%= l(:label_history) %> + <% end %> +
  • + <% end %> +<% end %>

    <%= l(:label_version) %> <%= link_to @diff.content_from.version, send(:"#{@content_type}_version_path", @meeting, @diff.content_from.version) %> diff --git a/app/views/meeting_contents/history.html.erb b/app/views/meeting_contents/history.html.erb index 759abbb789..2a72ff83e1 100644 --- a/app/views/meeting_contents/history.html.erb +++ b/app/views/meeting_contents/history.html.erb @@ -21,7 +21,7 @@ See doc/COPYRIGHT.md for more details. <% html_title "#{l(:label_history)}: #{@meeting.title}" %> -

    <%= l(:"label_#{@content_type}") %>: <%= link_to @meeting, @meeting %>

    +<%= toolbar title: "#{l(:"label_#{@content_type}")}: #{link_to @meeting, @meeting}" %>

    <%= l(:label_history) %>

    diff --git a/app/views/meetings/edit.html.erb b/app/views/meetings/edit.html.erb index 5c9dd5a6e2..097572ae0f 100644 --- a/app/views/meetings/edit.html.erb +++ b/app/views/meetings/edit.html.erb @@ -21,7 +21,7 @@ See doc/COPYRIGHT.md for more details. <% html_title "#{l(:label_meeting_edit)}: #{@meeting.title}" %> -

    <%= l(:label_meeting) %> #<%= @meeting.id %>

    +<%= toolbar title: "#{l(:label_meeting)} ##{@meeting.id}" %> <%= labelled_tabular_form_for @meeting, :url => {:controller => '/meetings', :action => 'update'}, :html => {:id => 'meeting-form', :method => :put} do |f| -%> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_save), class: 'button -highlight' %> diff --git a/app/views/meetings/index.html.erb b/app/views/meetings/index.html.erb index 8352d1c5cf..384a61c59b 100644 --- a/app/views/meetings/index.html.erb +++ b/app/views/meetings/index.html.erb @@ -21,8 +21,7 @@ See doc/COPYRIGHT.md for more details. <% html_title l(:label_meeting_plural) %> -

    <%= l(:label_meeting_plural)%>

    - +<%= toolbar title: l(:label_meeting_plural) %> <% if @meetings_by_start_year_month_date.empty? -%>

    <%= l(:label_no_data) %>

    <% else -%> diff --git a/app/views/meetings/new.html.erb b/app/views/meetings/new.html.erb index 781ece0c8b..4ce69d100f 100644 --- a/app/views/meetings/new.html.erb +++ b/app/views/meetings/new.html.erb @@ -20,8 +20,7 @@ See doc/COPYRIGHT.md for more details. ++#%> <% html_title l(:label_meeting_new) %> - -

    <%= l(:label_meeting_new) %>

    +<%= toolbar title: l(:label_meeting_new) %> <%= labelled_tabular_form_for @meeting, :url => {:controller => '/meetings', :action => 'create', :project_id => @project}, :html => {:id => 'meeting-form'} do |f| -%> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_create), class: 'button -highlight' %> diff --git a/app/views/meetings/show.html.erb b/app/views/meetings/show.html.erb index 27d9c71974..5c4f1840da 100644 --- a/app/views/meetings/show.html.erb +++ b/app/views/meetings/show.html.erb @@ -19,18 +19,40 @@ See doc/COPYRIGHT.md for more details. ++#%> -<% content_for :action_menu_specific do %> - <%= watcher_link @meeting, User.current %> - <%= link_to_if_authorized(l(:button_edit), {:controller => '/meetings', :action => 'edit', :id => @meeting}, :class => 'icon icon-edit', :accesskey => accesskey(:edit))%> - <%= link_to_if_authorized(l(:button_copy), {:controller => '/meetings', :action => 'copy', :id => @meeting}, :class => 'icon icon-copy')%> - <%= link_to_if_authorized(l(:button_delete), {:controller => '/meetings', :action => 'destroy', :id => @meeting}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-delete')%> -<% end %> - <% html_title "#{l(:label_meeting)}: #{@meeting.title}" %> +<%= toolbar title: "#{l(:label_meeting)}: #{link_to @meeting}" do %> + <% unless User.current.nil? %> +
  • +
    + <%= watcher_link @meeting, User.current %> +
    +
  • + <% end %> + <% if authorize_for(:meetings, :edit) %> +
  • + <%= link_to({:controller => '/meetings', :action => 'edit', :id => @meeting}, class: 'button',:accesskey => accesskey(:edit)) do%> + <%= l(:button_edit) %> + <% end %> +
  • + <% end %> + <% if authorize_for(:meetings, :copy) %> +
  • + <%= link_to({:controller => '/meetings', :action => 'copy', :id => @meeting}, class: 'button') do %> + <%= l(:button_copy) %> + <% end %> +
  • + <% end %> + <% if authorize_for(:meetings, :delete) %> +
  • + <%= link_to({:controller => '/meetings', :action => 'destroy', :id => @meeting}, class: 'button') do %> + <%= l(:button_delete) %> + <% end %> +
  • + <% end %> +<% end %>
    <%= render :partial => 'layouts/action_menu_specific' %> -

    <%= l(:label_meeting) %>: <%= link_to @meeting %>

    From 56c2b21c115b206257ca4c15b651f9044da130f8 Mon Sep 17 00:00:00 2001 From: Jan Sandbrink Date: Wed, 20 May 2015 11:51:09 +0200 Subject: [PATCH 2/2] correctly check for the anonymous user --- app/views/meetings/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/meetings/show.html.erb b/app/views/meetings/show.html.erb index 5c4f1840da..cb0bd9c489 100644 --- a/app/views/meetings/show.html.erb +++ b/app/views/meetings/show.html.erb @@ -21,7 +21,7 @@ See doc/COPYRIGHT.md for more details. <% html_title "#{l(:label_meeting)}: #{@meeting.title}" %> <%= toolbar title: "#{l(:label_meeting)}: #{link_to @meeting}" do %> - <% unless User.current.nil? %> + <% unless User.current.anonymous? %>
  • <%= watcher_link @meeting, User.current %>