Fast links
This commit is contained in:
parent
2dbadfc2c2
commit
5d6ed07eb3
@ -46,12 +46,13 @@ class DmsfLinksController < ApplicationController
|
||||
|
||||
def new
|
||||
@dmsf_link = DmsfLink.new
|
||||
member = Member.find_by_project_id_and_user_id(params[:project_id], User.current.id)
|
||||
@fast_links = member && member.dmsf_fast_links
|
||||
@dmsf_link.project_id = params[:project_id]
|
||||
@dmsf_link.dmsf_folder_id = params[:dmsf_folder_id]
|
||||
@dmsf_file_id = params[:dmsf_file_id]
|
||||
@type = params[:type]
|
||||
@dmsf_link.target_project_id = params[:project_id]
|
||||
@dmsf_link.project_id = params[:project_id]
|
||||
@target_folder_id = params[:dmsf_folder_id].to_i if params[:dmsf_folder_id].present?
|
||||
if @type == 'link_to'
|
||||
if @dmsf_file_id
|
||||
@ -115,9 +116,18 @@ class DmsfLinksController < ApplicationController
|
||||
end
|
||||
else
|
||||
# Link to
|
||||
@dmsf_link.project_id = params[:dmsf_link][:target_project_id]
|
||||
@dmsf_link.dmsf_folder_id = DmsfLinksHelper.is_a_number?(
|
||||
params[:dmsf_link][:target_folder_id]) ? params[:dmsf_link][:target_folder_id].to_i : nil
|
||||
if params[:dmsf_link][:target_project_id].present?
|
||||
@dmsf_link.project_id = params[:dmsf_link][:target_project_id]
|
||||
else
|
||||
target_folder = DmsfFolder.find_by_id(params[:dmsf_link][:target_folder_id])
|
||||
unless target_folder
|
||||
render_404
|
||||
return
|
||||
end
|
||||
@dmsf_link.project_id = target_folder.project_id
|
||||
end
|
||||
@dmsf_link.target_project_id = params[:dmsf_link][:project_id]
|
||||
if params[:dmsf_link][:dmsf_file_id].present?
|
||||
@dmsf_link.target_id = params[:dmsf_link][:dmsf_file_id]
|
||||
|
||||
@ -31,6 +31,7 @@ class DmsfStateController < ApplicationController
|
||||
if member
|
||||
member.dmsf_mail_notification = params[:email_notify]
|
||||
member.dmsf_title_format = params[:title_format]
|
||||
member.dmsf_fast_links = params[:fast_links].present?
|
||||
if format_valid?(member.dmsf_title_format) && member.save
|
||||
flash[:notice] = l(:notice_your_preferences_were_saved)
|
||||
else
|
||||
|
||||
@ -36,43 +36,53 @@
|
||||
<%= radio_button_tag(:external_link, 'true', false) %> <%= l(:label_external) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<div id="link_internal">
|
||||
<p>
|
||||
<% if @type == 'link_from' %>
|
||||
<label for="dmsf_link[target_project_id]"><%= l(:label_source_project) %></label>
|
||||
<% else %>
|
||||
<label for="dmsf_link[target_project_id]"><%= l(:label_target_project) %></label>
|
||||
<% end %>
|
||||
<%= select_tag('dmsf_link[target_project_id]',
|
||||
project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy,
|
||||
:selected => @dmsf_link.target_project), :style => "width=100%") %>
|
||||
<%= late_javascript_tag do %>
|
||||
$('#dmsf_link_target_project_id').change(function(){
|
||||
$.ajax({
|
||||
url: '<%= autocomplete_for_project_dmsf_link_path(@project, :format => 'js') %>',
|
||||
type: 'get',
|
||||
data: $('#new_dmsf_link').serialize()
|
||||
<div id="dmsf_link_internal">
|
||||
<% unless @fast_links && (@type == 'link_to') %>
|
||||
<p>
|
||||
<% if @type == 'link_from' %>
|
||||
<label for="dmsf_link[target_project_id]"><%= l(:label_source_project) %></label>
|
||||
<% else %>
|
||||
<label for="dmsf_link[target_project_id]"><%= l(:label_target_project) %></label>
|
||||
<% end %>
|
||||
<%= select_tag('dmsf_link[target_project_id]',
|
||||
project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy,
|
||||
:selected => @dmsf_link.target_project)) %>
|
||||
<%= late_javascript_tag do %>
|
||||
$('#dmsf_link_target_project_id').change(function(){
|
||||
$.ajax({
|
||||
url: '<%= autocomplete_for_project_dmsf_link_path(@project, :format => 'js') %>',
|
||||
type: 'get',
|
||||
data: $('#new_dmsf_link').serialize()
|
||||
});
|
||||
});
|
||||
});
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
<p>
|
||||
<% if @type == 'link_from' %>
|
||||
<%= label_tag('dmsf_link[target_folder_id]', l(:label_source_folder)) %>
|
||||
<% else %>
|
||||
<%= label_tag('dmsf_link[target_folder_id]', l(:label_target_folder)) %>
|
||||
<label for="dmsf_link_target_folder_id">
|
||||
<%= "#{l(:label_target_folder)} #" %>
|
||||
<span class="required">*</span>
|
||||
</label>
|
||||
<% if @fast_links %>
|
||||
<%= text_field_tag 'dmsf_link[target_folder_id]', '', :required => true, :max_length => 255 %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= select_tag('dmsf_link[target_folder_id]',
|
||||
folder_tree_options_for_select(DmsfFolder.directory_tree(@dmsf_link.target_project),
|
||||
:selected => @target_folder_id)) %>
|
||||
<%= late_javascript_tag do %>
|
||||
$('#dmsf_link_target_folder_id').change(function(){
|
||||
$.ajax({
|
||||
url: '<%= autocomplete_for_folder_dmsf_link_path(@project, :format => 'js') %>',
|
||||
type: 'get',
|
||||
data: $('#new_dmsf_link').serialize()
|
||||
<% unless @fast_links && (@type == 'link_to') %>
|
||||
<%= select_tag('dmsf_link[target_folder_id]',
|
||||
folder_tree_options_for_select(DmsfFolder.directory_tree(@dmsf_link.target_project),
|
||||
:selected => @target_folder_id)) %>
|
||||
<%= late_javascript_tag do %>
|
||||
$('#dmsf_link_target_folder_id').change(function(){
|
||||
$.ajax({
|
||||
url: '<%= autocomplete_for_folder_dmsf_link_path(@project, :format => 'js') %>',
|
||||
type: 'get',
|
||||
data: $('#new_dmsf_link').serialize()
|
||||
});
|
||||
});
|
||||
});
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
<% if @type == 'link_from' %>
|
||||
@ -85,7 +95,7 @@
|
||||
<% end %>
|
||||
</div>
|
||||
<% if (@type == 'link_from') && !@container %>
|
||||
<div id="link_external" style="display: none">
|
||||
<div id="dmsf_link_external">
|
||||
<p>
|
||||
<%= f.text_field :external_url, :required => false %>
|
||||
</p>
|
||||
@ -106,7 +116,7 @@
|
||||
|
||||
<%= late_javascript_tag do %>
|
||||
<%# Select2 extension, TODO: in case of a modal window, select2 makes problems %>
|
||||
<% unless modal %>
|
||||
<% unless modal || @fast_links %>
|
||||
$('#dmsf_link_target_project_id').select2();
|
||||
$('#dmsf_link_target_folder_id').select2();
|
||||
$('#dmsf_link_target_file_id').select2();
|
||||
@ -121,8 +131,8 @@
|
||||
});
|
||||
<%# Internal/External link switch %>
|
||||
$("input[name=external_link]:radio").change(function(){
|
||||
$("#link_internal").toggle();
|
||||
$("#link_external").toggle();
|
||||
$("#dmsf_link_internal").toggle();
|
||||
$("#dmsf_link_external").toggle();
|
||||
$("#dmsf_link_external_url").toggleClass('required', $(this).val());
|
||||
var labelUrl = $('label[for="dmsf_link_external_url"]');
|
||||
labelUrl.toggleClass('required', $(this).val());
|
||||
|
||||
@ -18,28 +18,40 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
<% member = @project.members.where(:user_id => User.current.id).first %>
|
||||
<% member = Member.find_by_project_id_and_user_id(@project.id, User.current.id) %>
|
||||
<% if member %>
|
||||
<% mail_notification = member.dmsf_mail_notification %>
|
||||
<% title_format = member.dmsf_title_format %>
|
||||
<% fast_links = member.dmsf_fast_links %>
|
||||
<% else %>
|
||||
<% mail_notification = false %>
|
||||
<% title_format = '' %>
|
||||
<% fast_links = false %>
|
||||
<% end %>
|
||||
|
||||
<%= form_tag(dmsf_user_pref_save_path(@project)) do %>
|
||||
<fieldset class="box tabular">
|
||||
<legend><%= l(:link_user_preferences) %></legend>
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_notifications)}:") %>
|
||||
<%= content_tag(:label, l(:label_notifications)) %>
|
||||
<%= select_tag(
|
||||
'email_notify',
|
||||
options_for_select([[l(:select_option_default), nil],
|
||||
[l(:select_option_activated), true], [l(:select_option_deactivated), false]],
|
||||
:selected => mail_notification)) %>
|
||||
:selected => mail_notification)) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_title_format)}:") %>
|
||||
<%= content_tag(:label, l(:label_title_format)) %>
|
||||
<%= text_field_tag 'title_format', title_format, :size => 10 %>
|
||||
<em class="info"><%= l(:text_title_format) %></em>
|
||||
</p>
|
||||
<p>
|
||||
<%= content_tag(:label, l(:label_dmsf_fast_links)) %>
|
||||
<%= check_box_tag('fast_links', 1, fast_links) %>
|
||||
<em class="info">
|
||||
<%= l(:text_dmsf_fast_links_info) %>
|
||||
</em>
|
||||
</p>
|
||||
</fieldset>
|
||||
<% if Setting.plugin_redmine_dmsf['dmsf_act_as_attachable'] %>
|
||||
<fieldset class="box tabular">
|
||||
|
||||
@ -358,10 +358,10 @@ div.dmsf_revision_inner_box .attribute .label {
|
||||
#dmsf_links_attachments_fields input.filename {border:0; height:1.8em; width:250px; color:#555; background-color:inherit; background:url(../../../images/link.png) no-repeat 1px 50%; padding-left:18px;}
|
||||
|
||||
/* New link form*/
|
||||
#dmsf_link_target_file_id, #dmsf_link_target_folder_id, #dmsf_link_target_project_id{
|
||||
#dmsf_link_target_file_id, #dmsf_link_target_folder_id, #dmsf_link_target_project_id, #dmsf_link_name{
|
||||
min-width: 40%;
|
||||
}
|
||||
|
||||
#dmsf_link_name{
|
||||
min-width: 38%;
|
||||
#dmsf_link_external{
|
||||
display: none;
|
||||
}
|
||||
@ -409,6 +409,10 @@ cs:
|
||||
slov. Odpovídající proměná prostředí musí být použita při indexaci.
|
||||
např.: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Rychlé odkazy
|
||||
text_dmsf_fast_links_info: Při vytváření odkazů budete moci zadat přímo ID cílového adresáře za účelem zrychlení
|
||||
procesu vytváření odkazů.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ de:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ en:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ es:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ fr:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ hu:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ it: # Italian strings thx 2 Matteo Arceci!
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ ja:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ ko:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ nl:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ pl:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ pt-BR:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ ru:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ sl:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ zh-TW:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
@ -409,6 +409,10 @@ zh:
|
||||
option needs to have been used at index time.
|
||||
e.g: XAPIAN_CJK_NGRAM=true ruby plugins/redmine_dmsf/extra/xapian_indexer.rb -fv"
|
||||
|
||||
label_dmsf_fast_links: Fast links
|
||||
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
|
||||
up the process of creating links.
|
||||
|
||||
easy_pages:
|
||||
modules:
|
||||
dmsf_locked_documents: My locked documents
|
||||
|
||||
30
db/migrate/20180903132101_fast_links.rb
Normal file
30
db/migrate/20180903132101_fast_links.rb
Normal file
@ -0,0 +1,30 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011-18 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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.
|
||||
|
||||
class FastLinks < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :members, :dmsf_fast_links, :boolean, :default => false, :null => false
|
||||
Member.update_all(:dmsf_fast_links => false)
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :members, :dmsf_fast_links
|
||||
end
|
||||
end
|
||||
@ -41,5 +41,8 @@ module RedmineDmsf
|
||||
end
|
||||
end
|
||||
|
||||
RedmineExtensions::PatchManager.register_helper_patch 'ProjectsHelper',
|
||||
'RedmineDmsf::Patches::ProjectHelperPatch', prepend: true
|
||||
#RedmineExtensions::PatchManager.register_helper_patch 'ProjectsHelper',
|
||||
# 'RedmineDmsf::Patches::ProjectHelperPatch', prepend: true
|
||||
|
||||
RedmineExtensions::PatchManager.register_patch_to_be_first 'ProjectsHelper',
|
||||
'RedmineDmsf::Patches::ProjectHelperPatch', prepend: true, first: true
|
||||
Loading…
x
Reference in New Issue
Block a user