Merge release/5.0 into dev

pull/6827/head
Oliver Günther 9 years ago
commit dc8ff2cc80
  1. 16
      app/assets/stylesheets/documents/documents.css.erb
  2. 50
      app/seeders/enumeration_seeder.rb
  3. 4
      app/views/documents/_document.html.erb
  4. 46
      app/views/documents/index.html.erb
  5. 5
      config/locales/en.yml

@ -37,3 +37,19 @@ dt.document:before {
.sidebar--document-sort label:last-of-type {
margin-bottom: 2rem;
}
.document-category-elements {
display: inline;
}
.document-category-elements--header {
margin-bottom: 0.25rem;
}
.document-category-elements--date {
margin-bottom: 0.75rem;
}
.document-category-elements .wiki {
margin-bottom: 2rem;
}

@ -0,0 +1,50 @@
#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
module BasicData
module Documents
class EnumerationsSeeder < Seeder
def seed_data!
category_names.each do |name|
DocumentCategory.create name: name
end
end
def category_names
category_i18n_keys.map { |key| I18n.t key }
end
def category_i18n_keys
['documentation', 'specification', 'other'].map do |name|
['enumeration', 'document_category', name].join('.')
end
end
end
end
end

@ -30,8 +30,8 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<h4><%= link_to h(document.title), :controller => '/documents', :action => 'show', :id => document %></h4>
<p><em><%= format_time(document.updated_on) %></em></p>
<h4 class="document-category-elements--header"><%= link_to h(document.title), :controller => '/documents', :action => 'show', :id => document %></h4>
<p class="document-category-elements--date"><em><%= format_time(document.updated_on) %></em></p>
<div class="wiki">
<%= format_text(truncate_lines(document.description)) %>

@ -47,29 +47,37 @@ See doc/COPYRIGHT.rdoc for more details.
<% end %>
<% @grouped.keys.sort.each do |group| %>
<h3><%= group %></h3>
<%= render :partial => 'documents/document', :collection => @grouped[group] %>
<fieldset class="form--fieldset -collapsible" onClick="toggleFieldset(this);">
<legend class="form--fieldset-legend"><%= group %></legend>
<div class="form--field document-category-elements">
<%= render :partial => 'documents/document', :collection => @grouped[group] %>
</div>
</fieldset>
<% end %>
<% content_for :sidebar do %>
<h3><%= l(:label_sort_by, '') %></h3>
<%= form_tag({}, :method => :get, class: 'sidebar--document-sort') do %>
<label>
<%= radio_button_tag 'sort_by', 'category', (@sort_by == 'category'), :onclick => 'this.form.submit();' %>
<%= Document.human_attribute_name(:category) %>
</label><br />
<label>
<%= radio_button_tag 'sort_by', 'date', (@sort_by == 'date'), :onclick => 'this.form.submit();' %>
<%= l(:label_date) %>
</label><br />
<label>
<%= radio_button_tag 'sort_by', 'title', (@sort_by == 'title'), :onclick => 'this.form.submit();' %>
<%= Document.human_attribute_name(:title) %>
</label><br />
<label>
<%= radio_button_tag 'sort_by', 'author', (@sort_by == 'author'), :onclick => 'this.form.submit();' %>
<%= Document.human_attribute_name(:author) %>
</label>
<fieldset class="form--fieldset">
<legend class="form--fieldset-legend"><%= l(:label_sort_by, '') %></legend>
<p>
<%= radio_button_tag 'sort_by', 'category', (@sort_by == 'category'), :onclick => 'this.form.submit();' %>
<label for="sort_by_category">
<%= Document.human_attribute_name(:category) %>
</label><br />
<%= radio_button_tag 'sort_by', 'date', (@sort_by == 'date'), :onclick => 'this.form.submit();' %>
<label for="sort_by_date">
<%= l(:label_date) %>
</label><br />
<%= radio_button_tag 'sort_by', 'title', (@sort_by == 'title'), :onclick => 'this.form.submit();' %>
<label for="sort_by_title">
<%= Document.human_attribute_name(:title) %>
</label><br />
<%= radio_button_tag 'sort_by', 'author', (@sort_by == 'author'), :onclick => 'this.form.submit();' %>
<label for="sort_by_author">
<%= Document.human_attribute_name(:author) %>
</label>
</p>
</fieldset>
<% end %>
<% end %>

@ -38,6 +38,11 @@ en:
default_doc_category_user: "User documentation"
enumeration_doc_categories: "Document categories"
enumeration:
document_category:
documentation: Documentation
specification: Specification
other: Other
label_document_added: "Document added"
label_document_new: "New document"

Loading…
Cancel
Save