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

end end
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 # Returns the theme, controller name, and action as css classes for the
# HTML body. # HTML body.
def body_css_classes def body_css_classes

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

<div class="contextual"> <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 @editable %>
<% if @content.current_version? %> <% if @content.current_version? %>
<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %> <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
<%= watcher_link(@page, User.current) %> <%= 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 %>
<% 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> </div>


<%= wiki_page_breadcrumb(@page) %> <%= wiki_page_breadcrumb(@page) %>

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

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


.drdn-content .quick-search {margin:8px;} .drdn-content .quick-search {margin:8px;}
.drdn-items>* { .drdn-items>* {
display:block; display:block;
border:1px solid #fff; border:1px solid #fff;
color:#555 !important;
overflow:hidden; overflow:hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space:nowrap; white-space:nowrap;
padding:4px 8px; 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>*:focus {border:1px dotted #bbb;}


.drdn-items.selection>*:before { .drdn-items.selection>*:before {
} }
.drdn-items>span {color:#999;} .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 {width:200px;display:inline-block;}
#project-jump .drdn-trigger { #project-jump .drdn-trigger {
width:100%;
height:24px;
display:inline-block; display:inline-block;
padding:3px 18px 3px 6px;
border-radius:3px; border-radius:3px;
border:1px solid #ccc; border:1px solid #ccc;
margin:0 !important; margin:0 !important;
vertical-align:middle; vertical-align:middle;
color:#555; 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-content {width:280px;}
#project-jump .drdn-items>* {color:#555 !important;}
#project-jump .drdn-items>a:hover {background-color:#759FCF; color:#fff !important;}


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

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

white-space: normal; white-space: normal;
} }


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


border: 1px solid #ddd; border: 1px solid #ddd;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
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, #content>.contextual a.icon,
p.buttons a.icon { p.buttons a.icon {
background-position-x: 4px;
padding-left: 25px; padding-left: 25px;
} }



Loading…
Cancel
Save