Restyle navigation and instructons on show and empty

This commit provides:
* Adjustments on breadcrumbs according to styling
* Restored indent in repository table
* Disallow closing checkout instructions on empty page

The repository indent for opened folders was removed in the re-styling
of tables in
7a844aa9d5
pull/3442/head
Oliver Günther 9 years ago
parent 14e74596a3
commit d81b20fee4
  1. 1
      app/assets/stylesheets/layout/_toolbar.sass
  2. 2
      app/assets/stylesheets/open_project_global/_variables.sass
  3. 20
      app/assets/stylesheets/scm.css.sass
  4. 3
      app/helpers/toolbar_helper.rb
  5. 27
      app/views/repositories/_breadcrumbs.html.erb
  6. 6
      app/views/repositories/_checkout_instructions.html.erb
  7. 2
      app/views/repositories/_dir_list_content.html.erb
  8. 15
      app/views/repositories/_repository_header.html.erb
  9. 12
      app/views/repositories/annotate.html.erb
  10. 8
      app/views/repositories/changes.html.erb
  11. 23
      app/views/repositories/empty.html.erb
  12. 13
      app/views/repositories/entry.html.erb
  13. 24
      app/views/repositories/show.html.erb
  14. 3
      config/locales/en.yml
  15. 4
      spec/legacy/functional/repositories_controller_spec.rb
  16. 8
      spec/legacy/functional/repositories_git_controller_spec.rb
  17. 4
      spec/legacy/functional/repositories_subversion_controller_spec.rb

@ -139,6 +139,7 @@
/** Allow select2 to display correctly in the toolbar */
.toolbar .select2-container
padding: 0
.select2-choice
height: 40px

@ -194,3 +194,5 @@ $user-avatar-mini-border-radius: 50px !default
$user-avatar-mini-width: 20px !default
$select-element-padding: 3px, 24px, 3px, 3px
$repository-breadcrumbs--color: #78818A

@ -80,6 +80,26 @@ li.change
.repository--checkout-instructions--url
margin-top: 1rem
.repository-breadcrumbs
font-size: 0.9rem
margin: 15px 0
.repository-breadcrumbs--home
color: $repository-breadcrumbs--color
font-size: 0.75rem
.repository-bradcrumbs--identifier
display: inline-block
margin-left: 10px
.repository-breadcrumbs--sep
display: inline-block
margin: 0 2px
&::before
content: ''
color: $repository-breadcrumbs--color
table.filecontent
border: 1px solid #ccc
border-collapse: collapse

@ -1,6 +1,7 @@
module ToolbarHelper
def toolbar(title:, subtitle: '', html: {})
content_tag :div, class: "toolbar-container #{html[:class]}" do
classes = ['toolbar-container', html[:class]].compact.join(' ')
content_tag :div, class: classes do
toolbar = content_tag :div, class: 'toolbar' do
dom_title(title) + dom_toolbar {
yield if block_given?

@ -27,30 +27,31 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<%= link_to 'root', :action => 'show', :project_id => @project, :path => nil, :rev => @rev %>
<%= link_to action: 'show', project_id: @project, path: nil, rev: @rev do %>
<i class="icon-home2 repository-breadcrumbs--home"></i>
<% end %>
<%
dirs = path.split('/')
if 'file' == kind
filename = dirs.pop
end
link_path = ''
dirs.each do |dir|
dirs.each_with_index do |dir, index|
next if dir.blank?
link_path << '/' unless link_path.empty?
link_path << "#{dir}"
%>
&#x00BB; <%= link_to h(dir), :action => 'show', :project_id => @project,
:path => to_path_param(link_path), :rev => @rev %>
<% end %>
<% if filename %>
&#x00BB; <%= link_to h(filename),
:action => 'changes', :project_id => @project,
:path => to_path_param("#{link_path}/#{filename}"), :rev => @rev %>
<span class="repository-breadcrumbs--sep"></span>
<% if index == dirs.size - 1 %>
<strong><%= h(dir) %></strong>
<% else %>
<%= link_to h(dir), action: 'show', project_id: @project,
path: to_path_param(link_path), rev: @rev %>
<% end %>
<% end %>
<%
# @rev is revsion or git branch or tag.
rev_text = @changeset.nil? ? @rev : format_revision(@changeset)
%>
<%= "@ #{h rev_text}" unless rev_text.blank? %>
<span class="repository-bradcrumbs--identifier">
(<%= l('repositories.at_identifier', identifier: rev_text) unless rev_text.blank? %>)
</span>
<% html_title(h(with_leading_slash(path))) -%>

@ -1,5 +1,7 @@
<div id="repository--checkout-instructions" class="notification-box -info">
<a href="#" class="notification-box--close">&times;</a>
<% unless embedded %>
<a href="javscript:" class="notification-box--close">&times;</a>
<% end %>
<div class="notification-box--content">
<p>
<%= simple_format instructions.instructions %>
@ -9,7 +11,7 @@
<strong><%= l("repositories.checkout.access.#{instructions.permission}") %></strong>
<% end %>
</p>
<% if show_url %>
<% if embedded %>
<div class="repository--checkout-instructions--url">
<form class="form">
<div class="form--field">

@ -32,7 +32,7 @@ See doc/COPYRIGHT.rdoc for more details.
<% ent_path = replace_invalid_utf8(entry.path) %>
<% ent_name = replace_invalid_utf8(entry.name) %>
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= h(entry.kind) %>">
<td class="filename">
<td class="filename" style="padding-left: <%=18 * depth%>px;">
<% if entry.dir? %>
<span class="icon-context dir-expander" onclick="<%= remote_function :url => {:action => 'show', :project_id => @project, :path => to_path_param(ent_path), :rev => @rev, :depth => (depth + 1), :parent_id => tr_id},
:method => :get,

@ -40,6 +40,9 @@ See doc/COPYRIGHT.rdoc for more details.
<input type="text" class="-clickable" size="40"
onclick="this.focus(); this.select()"
readonly="readonly" value="<%= @instructions.checkout_url %>">
<div class="toolbar-input-group--affix -append">
<span class="icon-copy3"></span>
</div>
</li>
<li class="toolbar-item -icon-only">
<a id="repository--checkout-instructions-toggle" class="button -pressed" href="javascript:"
@ -49,7 +52,7 @@ See doc/COPYRIGHT.rdoc for more details.
</a>
</li>
<% end %>
<% if User.current.allowed_to?(:browse_repository, @project) %>
<% if !empty && User.current.allowed_to?(:browse_repository, @project) %>
<li class="toolbar-item -icon-only">
<%= link_to stats_project_repository_path(@project),
class: 'button', title: l(:label_statistics) do %>
@ -58,7 +61,8 @@ See doc/COPYRIGHT.rdoc for more details.
<% end %>
</li>
<% end %>
<%= call_hook(:repositories_navigation_toolbar, { repository: @repository, project: @project }) %>
<%= call_hook(:repositories_navigation_toolbar,
{ repository: @repository, project: @project, repository_empty: empty }) %>
<% if User.current.allowed_to?(:manage_repository, @project) %>
<li class="toolbar-item -icon-only">
<%= link_to settings_project_path(@project, tab: 'repository'),
@ -70,3 +74,10 @@ See doc/COPYRIGHT.rdoc for more details.
<% end %>
<% end %>
<% if @instructions && @instructions.available? %>
<%= render partial: 'checkout_instructions',
locals: { repository: @repository, instructions: @instructions, embedded: false } %>
<% end %>

@ -26,9 +26,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See doc/COPYRIGHT.rdoc for more details.
++#%>
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<%= render :partial => 'navigation', locals: { merge: { kind: 'file' } } %>
<p><%= render :partial => 'link_to_functions' %></p>
<%= call_hook(:view_repositories_show_contextual, { repository: @repository, project: @project }) %>
<%= render partial: 'repository_header', locals: { empty: false } %>
<%# Breadcrumbs %>
<div class="repository-breadcrumbs">
<%= render partial: 'breadcrumbs',
locals: { path: @path, revision: @rev }.merge(kind: 'file') %>
</div>
<p><%= render partial: 'link_to_functions' %></p>
<% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
<div class="autoscroll">
<table class="filecontent annotate CodeRay">

@ -28,8 +28,14 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<%= render partial: 'repository_header', locals: { empty: false } %>
<%# Breadcrumbs %>
<div class="repository-breadcrumbs">
<%= render partial: 'breadcrumbs',
locals: { path: @path, revision: @rev }.merge(kind: (@entry ? @entry.kind : nil)) %>
</div>
<%= render :partial => 'navigation', locals: { merge: { kind: (@entry ? @entry.kind : nil) } } %>
<p><%= render :partial => 'link_to_functions' %></p>

@ -27,17 +27,20 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<div class="notification-box -warning">
<div class="notification-box--content">
<p><%= l('repositories.errors.exception_title',
message: l('repositories.errors.empty_repository')) %></p>
<%= render partial: 'repository_header',
locals: { empty: true } %>
<div class="generic-table--container">
<div class="generic-table--no-results-container">
<h2 class="generic-table--no-results-title">
<i class="icon-info"></i>
<%= l(:label_nothing_display) %>
</h2>
<div class="generic-table--no-results-description">
<p class="nodata"><%= l('repositories.errors.empty_repository') %></p>
</div>
</div>
</div>
<% if @instructions && @instructions.available? %>
<%= render partial: 'checkout_instructions',
locals: { repository: @repository, instructions: @instructions, show_url: true } %>
<% end %>
<%= call_hook(:view_repositories_show_contextual,
{ repository: @repository, project: @project }) %>
<%= call_hook(:repositories_below_empty_warning,
{ repository: @repository, project: @project }) %>

@ -27,10 +27,15 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<%= call_hook(:view_repositories_show_contextual, { repository: @repository, project: @project }) %>
<%= render :partial => 'navigation', locals: { merge: { kind: 'file'} } %>
<%= render partial: 'repository_header', locals: { empty: false } %>
<p><%= render :partial => 'link_to_functions' %></p>
<div class="repository-breadcrumbs">
<%= render partial: 'breadcrumbs',
locals: { path: @path, revision: @rev }.merge(kind: 'dir') %>
</div>
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
<p><%= render partial: 'link_to_functions' %></p>
<%= render partial: 'common/file', locals: {filename: @path, content: @content} %>

@ -27,21 +27,11 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<%= call_hook(:view_repositories_show_contextual, { repository: @repository, project: @project }) %>
<%= render partial: 'navigation' %>
<%= render partial: 'repo_header', locals: { empty: false } %>
<%# Checkout %>
<% if @instructions && @instructions.available? %>
<%= render partial: 'checkout_instructions',
locals: { repository: @repository, instructions: @instructions, show_url: false } %>
<% end %>
<%# Breadcrumbs %>
<div>
<h3>
<%= render partial: 'breadcrumbs',
locals: { path: @path, revision: @rev }.merge(kind: 'dir') %>
</h3>
<div class="repository-breadcrumbs">
<%= render partial: 'breadcrumbs',
locals: { path: @path, revision: @rev }.merge(kind: 'dir') %>
</div>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
@ -91,9 +81,9 @@ See doc/COPYRIGHT.rdoc for more details.
</li>
<% end %>
<li class="toolbar-item -icon-only">
<%= link_to 'Atom',
url: { action: 'revisions', project_id: @project, key: User.current.rss_key },
class: 'button', title: l('repositories.atom_revision_feed') do %>
<%= link_to({ url: { action: 'revisions', project_id: @project,
key: User.current.rss_key } },
{ class: 'button', title: l('repositories.atom_revision_feed') }) do %>
<i class="button--icon icon-page-atom"></i>
<span class="button--text"></span>
<% end %>

@ -1294,8 +1294,9 @@ en:
subproject_id: "Subproject"
repositories:
autofetch_information: "Check this if you want repositories to be updated automatically when accessing the repository module page.\nThis encompasses the retrieval of commits from the repository and refreshing the required disk storage."
at_identifier: 'at %{identifier}'
atom_revision_feed: 'Atom revision feed'
autofetch_information: "Check this if you want repositories to be updated automatically when accessing the repository module page.\nThis encompasses the retrieval of commits from the repository and refreshing the required disk storage."
checkout:
access:
readwrite: 'Read + Write'

@ -68,7 +68,7 @@ describe RepositoriesController, type: :controller do
assert_response :success
assert_template 'revision'
assert_no_tag tag: 'ul',
attributes: { id: 'toolbar-items' },
attributes: { class: 'toolbar-items' },
descendant: { tag: 'a',
attributes: {
href: @controller.url_for(
@ -81,7 +81,7 @@ describe RepositoriesController, type: :controller do
}
}
assert_tag tag: 'ul',
attributes: { id: 'toolbar-items' },
attributes: { class: 'toolbar-items' },
descendant: { tag: 'a',
attributes: {
href: @controller.url_for(

@ -147,7 +147,9 @@ describe RepositoriesController, 'Git', type: :controller do
get :changes, project_id: 3, path: 'images/edit.png'
assert_response :success
assert_template 'changes'
assert_tag tag: 'h3', content: 'edit.png'
assert_tag tag: 'div',
attributes: { class: 'repository-breadcrumbs' },
content: 'edit.png'
end
it 'should entry show' do
@ -224,7 +226,9 @@ describe RepositoriesController, 'Git', type: :controller do
get :annotate, project_id: 3, rev: 'deff7', path: 'sources/watchers_controller.rb'
assert_response :success
assert_template 'annotate'
assert_tag tag: 'h3', content: /@ deff712f/
assert_tag tag: 'div',
attributes: { class: 'repository-breadcrumbs' },
content: /at deff712f/
end
it 'should annotate binary file' do

@ -302,6 +302,8 @@ describe RepositoriesController, 'Subversion', type: :controller do
get :annotate, project_id: PRJ_ID, rev: 8, path: 'subversion_test/helloworld.c'
assert_response :success
assert_template 'annotate'
assert_tag tag: 'h3', content: /@ 8/
assert_tag tag: 'div',
attributes: { class: 'repository-breadcrumbs' },
content: /at 8/
end
end

Loading…
Cancel
Save