Browse Source

Moves some action links on the wiki page to a dropdown menu (#26575).

git-svn-id: http://svn.redmine.org/redmine/trunk@17678 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.0.0
Jean-Philippe Lang 5 years ago
parent
commit
8dd6874a6a

+ 11
- 0
app/helpers/application_helper.rb View File

@@ -623,6 +623,17 @@ module ApplicationHelper
end
end

def actions_dropdown(&block)
content = capture(&block)
if content.present?
trigger = content_tag('span', l(:button_actions), :class => 'icon-only icon-actions', :title => l(:button_actions))
trigger = content_tag('span', trigger, :class => 'drdn-trigger')
content = content_tag('div', content, :class => 'drdn-items')
content = content_tag('div', content, :class => 'drdn-content')
content_tag('span', trigger + content, :class => 'drdn')
end
end

# Returns the theme, controller name, and action as css classes for the
# HTML body.
def body_css_classes

+ 20
- 10
app/views/wiki/show.html.erb View File

@@ -1,20 +1,30 @@
<div class="contextual">
<% if User.current.allowed_to?(:edit_wiki_pages, @project) %>
<%= link_to l(:label_wiki_page_new), new_project_wiki_page_path(@project, :parent => @page.title), :remote => true, :class => 'icon icon-add' %>
<% end %>

<% if @editable %>
<% if @content.current_version? %>
<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
<%= watcher_link(@page, User.current) %>
<%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') %>
<% else %>
<%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') %>
<% end %>
<% end %>
<%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>

<%= actions_dropdown do %>
<%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>

<% if @editable %>
<% if @content.current_version? %>
<%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') %>
<% else %>
<%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') %>
<% end %>
<% end %>

<% if User.current.allowed_to?(:edit_wiki_pages, @project) %>
<%= link_to l(:label_wiki_page_new), new_project_wiki_page_path(@project, :parent => @page.title), :remote => true, :class => 'icon icon-add' %>
<% end %>
<% end %>
</div>

<%= wiki_page_breadcrumb(@page) %>

+ 12
- 7
public/stylesheets/application.css View File

@@ -143,14 +143,10 @@ a#toggle-completed-versions {color:#999;}
/***** Dropdown *****/
.drdn {position:relative;}
.drdn-trigger {
width:100%;
height:24px;
box-sizing:border-box;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
padding:3px 18px 3px 6px;
background:#fff url(../images/arrow_down.png) no-repeat 97% 50%;
cursor:pointer;
user-select:none;
-moz-user-select:none;
@@ -168,7 +164,6 @@ a#toggle-completed-versions {color:#999;}
color:#555;
z-index:99;
}
.drdn.expanded .drdn-trigger {background-image:url(../images/arrow_up.png);}
.drdn.expanded .drdn-content {display:block;}

.drdn-content .quick-search {margin:8px;}
@@ -179,13 +174,12 @@ div + .drdn-items {border-top:1px solid #ccc;}
.drdn-items>* {
display:block;
border:1px solid #fff;
color:#555 !important;
overflow:hidden;
text-overflow: ellipsis;
white-space:nowrap;
padding:4px 8px;
}
.drdn-items>a:hover {text-decoration:none; background-color:#759FCF; color:#fff !important;}
.drdn-items>a:hover {text-decoration:none;}
.drdn-items>*:focus {border:1px dotted #bbb;}

.drdn-items.selection>*:before {
@@ -205,16 +199,27 @@ div + .drdn-items {border-top:1px solid #ccc;}
}
.drdn-items>span {color:#999;}

.contextual .drdn-content {top:18px;}
.contextual .drdn-items {padding:2px;}
.contextual .drdn-items>a:hover {color:#2A5685; border:1px solid #628db6; background-color:#eef5fd; border-radius:3px;}

#project-jump.drdn {width:200px;display:inline-block;}
#project-jump .drdn-trigger {
width:100%;
height:24px;
display:inline-block;
padding:3px 18px 3px 6px;
border-radius:3px;
border:1px solid #ccc;
margin:0 !important;
vertical-align:middle;
color:#555;
background:#fff url(../images/arrow_down.png) no-repeat 97% 50%;
}
#project-jump .drdn.expanded .drdn-trigger {background-image:url(../images/arrow_up.png);}
#project-jump .drdn-content {width:280px;}
#project-jump .drdn-items>* {color:#555 !important;}
#project-jump .drdn-items>a:hover {background-color:#759FCF; color:#fff !important;}

/***** Tables *****/
table.list, .table-list { border: 1px solid #e4e4e4; border-collapse: collapse; width: 100%; margin-bottom: 4px; }

+ 12
- 3
public/stylesheets/responsive.css View File

@@ -598,7 +598,8 @@
white-space: normal;
}

#content>.contextual a,
#content>.contextual>a,
#content>.contextual .drdn,
p.buttons a {
font-weight: bold;

@@ -611,12 +612,20 @@
border: 1px solid #ddd;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color: transparent;
background-position-x: 4px;
}
#content>.contextual .drdn-content {
right:initial;
left:0px;
top:40px;
}
#content>.contextual .drdn .drdn-content a {
padding-top: 9px;
padding-bottom: 9px;
}

#content>.contextual a.icon,
p.buttons a.icon {
background-position-x: 4px;
padding-left: 25px;
}


Loading…
Cancel
Save