Nuevo plugin Redmine Glossary 0.9.2

This commit is contained in:
Manuel Cillero 2019-01-29 19:42:59 +01:00
parent 5d298a7529
commit 693eb3ee50
72 changed files with 2962 additions and 0 deletions

View file

@ -0,0 +1,10 @@
<h3 class="title"><%=l(:label_term_category_new)%></h3>
<% form = labelled_form_for @category, :as => :category, :url => { :action => 'add_term_category', :project_id => @project }, :html => {:class => 'tabular'} do |f| %>
<%= render :partial => 'term_categories/form', :locals => { :f => f } %>
<p class="buttons">
<%= submit_tag l(:button_create), :name => nil %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
</p>
<% end %>
<%= form if Rails::VERSION::MAJOR >= 3 %>

View file

@ -0,0 +1,38 @@
<p><%= f.text_field :name, :label=>t('label.name'), :size => 100, :required => true %></p>
<% for prm in Term.setting_params %>
<% if param_visible?(prm) %>
<p><%= f.text_field prm, :label=>label_param(prm), :size => 100 %></p>
<% end %>
<% end %>
<div class="splitcontentleft">
<p><%= f.select :category_id, (@term_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>
<% if Rails::VERSION::MAJOR >= 3 %>
<%= link_to(l(:label_term_category_new),
{:controller => 'glossary', :action => 'add_term_category', :project_id => @project.id },
:category => 'category[name]',
:class => 'icon icon-add',
:tabindex => 199,
:method => 'get',
:remote => true) if authorize_for('glossary', 'add_term_category') %></p>
<% else %>
<%= prompt_to_remote(l(:label_term_category_new),
l(:label_term_category_new), 'category[name]',
{:controller => 'glossary', :action => 'add_term_category', :project_id => @project },
:class => 'icon icon-add', :tabindex => 199) if authorize_for('glossary', 'add_term_category') %></p>
<% end %>
</div>
<p><%= f.text_area :description, :label=>t('label.description'),
:cols => 60,
:rows => (@term.description.blank? ? 10 : [[10, @term.description.length / 50].max, 100].min),
:accesskey => accesskey(:edit),
:class => 'wiki-edit' %></p>
<p />
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
<%= wikitoolbar_for 'term_description' %>

View file

@ -0,0 +1,31 @@
<table class="list glossary">
<thead><tr align="left">
<th>#</th>
<th><%=h t('label.name') %></th>
<% for prm in @show_params %>
<th><%=h label_param(prm) %></th>
<% end %>
<th><%=h l(:field_description)%></th>
<th></th>
</tr></thead>
<tbody>
<% for term in index_in_category -%>
<tr class="<%= cycle("odd", "even") %> term">
<td><%=h term.id %></td>
<td><%= term_link(term) %></td>
<% for prm in @show_params %>
<td><%=h term.value(prm) %></td>
<% end %>
<!--td><%=h truncate(term.description, :length=>50) %></td-->
<td><%=textilizable term.description %></td>
<td align="right" width="40px">
<% if term.project_id == @project.id %>
<%= link_to_if_authorized(image_tag('edit.png'), {:action => 'edit', :project_id => @project, :id => term}, :title => l(:button_edit)) %>
<%= link_to_if_authorized(image_tag('delete.png'), {:action => 'destroy', :project_id => @project, :id => term}, :confirm => l(:text_are_you_sure), :method => :post, :title => l(:button_delete)) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<br />

View file

@ -0,0 +1,10 @@
<% for term in show_all_in_category -%>
<div class="term" >
<h3> <%= term_link(term) %> </h3>
<%= render(:partial => "glossary/show_one", :object => term) %>
</div>
<br />
<% end %>
<br />

View file

@ -0,0 +1,19 @@
<% term = show_one %>
<table class="term_items">
<% for prm in @show_params %>
<tr><th><%=h label_param(prm) %>:</th><td><%= term.value(prm) %></td></tr>
<% end %>
</table>
<% unless (term.description.empty?) %>
<strong><%=l(:field_description)%></strong>:
<div class="wiki">
<%= textilizable term, :description, :attachments => term.attachments %>
</div>
<% if term.attachments.any? %>
<%= (@is_index) ? "" : '<hr />' %>
<%= link_to_attachments term %>
<% end %>
<% end %>

View file

@ -0,0 +1,44 @@
<% if User.current.allowed_to?(:view_terms, @project, :global => true) %>
<h3><%= l(:label_view) %></h3>
<%= render(:partial => "glossary_styles/form",
:object => @view_style) %>
<br />
<% end %>
<% if User.current.allowed_to?(:manage_terms, @project, :global => true) %>
<h3><%= l(:label_term) %></h3>
<%= link_to(l(:label_term_new), {:controller => 'glossary', :action => 'new', :project_id => @project}, :class => 'icon icon-add') %>
<br />
<% if (Term.find_by(:project_id => @project.id)) %>
<%= link_to_if_authorized(l(:label_move_all_terms), {:controller => 'glossary', :action => 'move_all', :project_id => @project}, :class => 'icon icon-move') %>
<br />
<% end %>
<%= link_to(l(:label_glossary_import_csv), {:controller => 'glossary', :action => 'import_csv', :project_id => @project}) %>
<br />
<% end %>
<% if User.current.allowed_to?(:manage_term_categories, @project, :global => true) %>
<h3><%= l(:label_term_category) %></h3>
<%= link_to l(:label_term_category_new), {:controller => 'glossary', :action => 'add_term_category', :project_id => @project}, :class => 'icon icon-add' %>
<br />
<%= link_to l(:label_manage_term_category), { :controller => 'term_categories', :action => 'index', :project_id => @project } %>
<br />
<% end %>
<% if User.current.allowed_to?(:view_terms, @project, :global => true) %>
<h3><%= l(:label_glossary_style_index) %></h3>
<% if params[:search_index_ch] %>
<div class="contextual">
<%= link_to_if_authorized(l(:button_clear), {:controller => 'glossary', :action => 'index_clear', :project_id => @project}, :class => 'icon icon-reload') %>
</div>
<% end %>
<%= search_index_table(l(:index_ary_en), l(:index_ary_en_sep_cnt), @project, 'en') %>
<br />
<%= search_index_table(l(:index_ary), l(:index_ary_sep_cnt), @project) %>
<br />
<% end %>

View file

@ -0,0 +1,10 @@
<% content_for :sidebar do %>
<%= render :partial => 'glossary/sidebar' %>
<% end %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'glossary', :plugin => 'redmine_glossary' %>
<% end %>
<% html_title(l(:glossary_title)) -%>

View file

@ -0,0 +1,9 @@
<h2><%=l(:label_term_category_new)%></h2>
<% form = labelled_form_for @category, :as => :category, :url => { :action => 'add_term_category', :project_id => @project }, :html => {:class => 'tabular'} do |f| %>
<%= render :partial => 'term_categories/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create) %>
<% end %>
<%= form if Rails::VERSION::MAJOR >= 3 %>
<% html_title(l(:glossary_title)) -%>

View file

@ -0,0 +1,2 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'glossary/add_term_category_modal') %>');
showModal('ajax-modal', '600px');

View file

@ -0,0 +1,29 @@
<h2><%= l(:label_term) %> #<%= @term.id %></h2>
<% form = labelled_form_for @term, :as => :term,
:url => {:action => 'edit', :project_id => @project, :id => @term},
:html => {:class => 'tabular', :multipart => true, :id => 'term-form'} do |f| %>
<%= error_messages_for 'term' %>
<div class="box">
<%= render :partial => 'glossary/form', :locals => {:f => f} %>
</div>
<%= submit_tag l(:button_edit) %>
<% if Rails::VERSION::MAJOR >= 3 %>
<%= preview_link({:controller => 'glossary', :action => 'preview', :project_id => @project.id },
"term-form",
"preview") %>
<% else %>
<%= link_to_remote l(:label_preview),
{ :url => { :controller => 'glossary', :action => 'preview', :project_id => @project },
:method => 'post',
:update => 'preview',
:with => "Form.serialize('term-form')",
:complete => "Element.scrollTo('preview')"
}, :accesskey => accesskey(:preview) %>
<% end %>
<% end %>
<%= form if Rails::VERSION::MAJOR >= 3 %>
<div id="preview" class="wiki"></div>
<% html_title(l(:glossary_title)) -%>

View file

@ -0,0 +1,57 @@
<h2><%=h l(:label_glossary_import_csv) %> </h2>
<% form = form_tag({:controller => 'glossary', :action => 'import_csv_exec', :project_id=>@project},
{:multipart => true}) do %>
<%= l(:label_csv_file) %>
<%= file_field_tag 'import_file', :accept => 'text/csv', :size => '60%' %>
<br />
<br />
<% encs = l(:in_encoding_candidates)
if (encs and encs.is_a?(Array) and !encs.empty?)
enc_options = []
encs.each {|enc|
enc_options << enc
}
%>
<%=h l(:label_file_encoding) %>
<%= select_tag("in_encoding", options_for_select(enc_options)) %>
<br />
<% end %>
<label> <%= check_box_tag("is_first_comment", '1', true) %>
<%= l(:label_csv_import_is_first_comment) %> </label>
<br />
<br />
<%
name_options = []
options = [""]
for num in 1 ... 30
name_options << num
options << num
end
%>
<fieldset>
<legend><%= l(:label_import_items) %></legend>
<table>
<tr><th><%=h l(:label_item) %></th><th><%=h l(:label_column) %></th></tr>
<% CsvGlossaryImportInfo.default_param_cols {|prm, col| %>
<tr><td><%=h label_param(prm) %></td><td>
<%= select_tag("colno_#{prm}",
options_for_select((prm == 'name') ? name_options : options, col)) %>
</td></tr>
<% } %>
</table>
* <%=h l(:message_import_item) %>
</fieldset>
<br />
<%= submit_tag(l(:label_import)) %>
<% end %>
<%= form if Rails::VERSION::MAJOR >= 3 %>
<% html_title(l(:glossary_title)) -%>

View file

@ -0,0 +1,13 @@
<h2> <%=h l(:label_csv_import_finished) %> </h2>
<table class="term_items">
<tr><th><%=h l(:label_csv_file) %> : </th><td>
<%=h (@import_info.import_file) ? @import_info.import_file.original_filename : "" %>
</td></tr>
<tr><th><%=h l(:label_create_category_num) %> : </th><td> <%= @import_info.cat_num %> </td></tr>
<tr><th><%=h l(:label_create_term_num) %> : </th><td> <%= @import_info.newterm_num %> </td></tr>
<tr><th><%=h l(:label_update_term_num) %> : </th><td> <%= @import_info.upterm_num %> </td></tr>
</table>
<%= render :partial => 'glossary/view_term' %>

View file

@ -0,0 +1,42 @@
<div class="contextual">
<%= link_to_if_authorized(l(:label_term_new), {:controller => 'glossary', :action => 'new', :project_id => @project}, :class => 'icon icon-add') %>
</div>
<%
subtitle = ""
if params[:search_index_ch]
subtitlle = "- #{params[:search_index_ch]} -"
end %>
<h1><%= t('glossary_title') %> <%= subtitlle %> </h1>
<br />
<% if User.current.allowed_to?(:view_terms, @project, :global => true) %>
<%= render(:partial => "glossary_styles/search") %>
<br />
<% end %>
<% tempname = "glossary/#{@glossary_style.show_desc ? 'show_all' : 'index'}_in_category" %>
<% unless @terms.empty? %>
<% if @glossary_style.grouping? %>
<% list_number = 1 %>
<% @terms.each do |gterms| %>
<h2><%= "#{list_number}. #{gterms.name}" %></h2>
<% list_number += 1 %>
<%= render(:partial => tempname, :object => gterms.ary) %>
<% end %>
<% else %>
<%= render(:partial => tempname, :object => @terms) %>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'CSV', :url => params %>
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<%= render :partial => 'glossary/view_term' %>

View file

@ -0,0 +1,22 @@
<h2><%= l(:label_move_all_terms) %></h2>
<% if params[:new_project_id] %>
<% elsif @allowed_projs.blank? %>
<div class="nodata">
<%= simple_format(l(:error_no_movement_project)) %>
</div>
<% else %>
<% form = form_tag({:project_id => @project}, :id => 'move_all_form') do %>
<div class="box tabular">
<p><label for="new_project_id"><%=l(:label_movement_project)%>:</label>
<%= select_tag "new_project_id",
project_tree_options_for_select(@allowed_projs) %>
</p>
</div>
<%= submit_tag l(:button_move) %>
<% end %>
<%= form if Rails::VERSION::MAJOR >= 3 %>
<% end %>

View file

@ -0,0 +1,30 @@
<h2><%=l(:label_term_new)%></h2>
<% form = labelled_form_for @term, :as => :term,
:url => {:action => 'new', :project_id => @project, :id => @term},
:html => {:class => 'tabular', :multipart => true, :id => 'term-form'} do |f| %>
<%= error_messages_for 'term' %>
<div class="box">
<%= render :partial => 'glossary/form', :locals => {:f => f} %>
</div>
<%= submit_tag l(:button_create) %>
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
<% if Rails::VERSION::MAJOR >= 3 %>
<%= preview_link({:controller => 'glossary', :action => 'preview', :project_id => @project.id },
"term-form",
"preview") %>
<% else %>
<%= link_to_remote l(:label_preview),
{ :url => { :controller => 'glossary', :action => 'preview', :project_id => @project },
:method => 'post',
:update => 'preview',
:with => "Form.serialize('term-form')",
:complete => "Element.scrollTo('preview')"
}, :accesskey => accesskey(:preview) %>
<% end %>
<% end %>
<%= form if Rails::VERSION::MAJOR >= 3 %>
<div id="preview" class="wiki"></div>
<% html_title(l(:glossary_title)) -%>

View file

@ -0,0 +1,29 @@
<div class="contextual">
<%= link_to_if_authorized(l(:button_edit), {:controller => 'glossary', :action => 'edit', :project_id => @project, :id => @term}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'glossary', :action => 'destroy', :project_id => @project, :id => @term}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
</div>
<h2><%= l(:label_term) %> #<%= @term.id %></h2>
<div class="term" >
<h3><%=h @term.name %> </h3>
<%= render(:partial => "glossary/show_one", :object => @term) %>
<p class="author">
<%= authoring @term.created_on, @term.author %>.
<% if @term.created_on != @term.updated_on
if (@term.author_id == @term.updater_id) %>
<%= l(:label_updated_time, time_tag(@term.updated_on)).html_safe + '.' %>
<% else %>
<%= updated_by(@term.updated_on, @term.updater) + '.' %>
<% end %>
<% end %>
</p>
</div>
<%= render :partial => 'glossary/view_term' %>
<% html_title "##{@term.id}: #{@term.name}" -%>