Actualizar plugin Additionals a 3.0.0

This commit is contained in:
Manuel Cillero 2020-11-22 21:30:25 +01:00
parent 3d976f1b3b
commit a26f5567af
399 changed files with 70374 additions and 4093 deletions

View file

@ -0,0 +1,90 @@
= error_messages_for 'dashboard'
.box.tabular.attributes
p
= f.text_field :name, size: 255, required: true
p
= f.text_area :description, rows: addtionals_textarea_cols(@dashboard.description, min: 4), class: 'wiki-edit'
.splitcontent
.splitcontentleft
- if @dashboard.new_record?
= hidden_field_tag 'dashboard[dashboard_type]', @dashboard.dashboard_type
- if @project && @allowed_projects.present? && @allowed_projects.count > 1
p
= f.select :project_id,
project_tree_options_for_select(@allowed_projects,
selected: @dashboard.project,
include_blank: true),
{},
disabled: !@dashboard.project_id_can_change?
em.info
= l(:info_dashboard_project_select)
- else
= hidden_field_tag 'dashboard[project_id]', @project&.id
- if User.current.allowed_to?(:share_dashboards, @project, global: true) || \
User.current.allowed_to?(:set_system_dashboards, @project, global: true)
p
label = l(:field_visible)
label.block
= radio_button 'dashboard', 'visibility', Dashboard::VISIBILITY_PRIVATE
'
= l(:label_visibility_private)
label.block
= radio_button 'dashboard', 'visibility', Dashboard::VISIBILITY_PUBLIC
'
= l(:label_visibility_public)
label.block
= radio_button 'dashboard', 'visibility', Dashboard::VISIBILITY_ROLES
'
= l(:label_visibility_roles)
' :
- Role.givable.sorted.each do |role|
label.block.role-visibility
= check_box_tag 'dashboard[role_ids][]', role.id, @dashboard.role_ids.include?(role.id), id: nil
'
= role.name
= hidden_field_tag 'dashboard[role_ids][]', ''
.splitcontentright
p
= f.check_box :enable_sidebar
- if User.current.allowed_to? :set_system_dashboards, @project, global: true
p = f.check_box :system_default, disabled: !@dashboard.destroyable?
p#always-expose = f.check_box :always_expose
- elsif @dashboard.system_default?
p = f.check_box :system_default, disabled: true
p = f.check_box :always_expose
- if @dashboard.persisted?
p.object-select
= f.select :author_id,
author_options_for_select(@project, @dashboard, :save_dashboards),
required: true
= call_hook :view_dashboard_form_details_bottom, dashboard: @dashboard, form: f
javascript:
$(function() {
$("input[name='dashboard[visibility]']").change(function(){
var roles_checked = $('#dashboard_visibility_1').is(':checked');
var private_checked = $('#dashboard_visibility_0').is(':checked');
$("input[name='dashboard[role_ids][]'][type=checkbox]").attr('disabled', !roles_checked);
}).trigger('change');
$("input[name='dashboard[system_default]']").change(function(){
var selection = $('#dashboard_system_default').is(':checked');
if (selection) {
$('#always-expose').show();
}
else {
$('#always-expose').hide();
}
}).trigger('change');
});

View file

@ -0,0 +1,3 @@
$("#block-<%= escape_javascript @block %>").remove();
$("#list-top").prepend("<%= escape_javascript render_dashboard_blocks([@block], @dashboard) %>");
$("#block-select").replaceWith("<%= escape_javascript dashboard_block_select_tag(@dashboard) %>");

View file

@ -0,0 +1,4 @@
p#errorExplanation
' An error occurred while executing dashboard block
= tag.i @block
' and has been logged. Please report this error to your Redmine administrator.

View file

@ -0,0 +1,11 @@
- cache render_async_cache_key(_dashboard_async_blocks_path(@project,
dashboard.async_params(block, async, settings))),
expires_in: async[:cache_expires_in] || DashboardContent::RENDER_ASYNC_CACHE_EXPIRES_IN,
skip_digest: true do
- events_by_day = activity_dashboard_data settings, dashboard
- title = Additionals.true?(settings[:me_only]) ? l(:label_my_activity) : l(:label_activity)
h3 = link_to title, activity_path(user_id: User.current,
from: events_by_day.keys.first)
= render partial: 'activities/activities', locals: { events_by_day: events_by_day }

View file

@ -0,0 +1,21 @@
- max_entries = settings[:max_entries].presence || DashboardContent::DEFAULT_MAX_ENTRIES
div id="#{block}-settings" style="#{'display: none;' if hide}"
= form_tag(_update_layout_setting_dashboard_path(@project, @dashboard), remote: true) do
= hidden_field_tag "settings[#{block}][me_only]", '0'
.box
p
label
= l(:label_max_entries)
' :
= number_field_tag "settings[#{block}][max_entries]", max_entries, min: 1, max: 1000, required: true
p
label
= l(:label_only_my_activities)
' :
= check_box_tag "settings[#{block}][me_only]", '1', Additionals.true?(settings[:me_only])
p
= submit_tag l(:button_save)
'
= link_to_function l(:button_cancel), "$('##{block}-settings').toggle();"

View file

@ -0,0 +1,31 @@
- with_async = dashboard_async_required_settings? settings, async
- unless with_async
h3 = settings[:title].presence || block_definition[:label]
- if @can_edit && \
block_definition[:no_settings].blank? && \
(!block_definition.key?(:with_settings_if) || block_definition[:with_settings_if].call(@project))
= render partial: block_definition[:settings_partial].presence || "#{async[:partial]}_settings",
locals: build_dashboard_partial_locals(block,
block_definition,
settings,
dashboard).merge({ hide: with_async })
- if with_async
= render_async_cache _dashboard_async_blocks_path(@project,
dashboard.async_params(block, async, settings)) do
.clear-both
p
i.fas.fa-sync.fa-spin
'
= l(:label_loading)
= content_for :render_async
javascript:
$(function() {
$('#ajax-indicator').hide();
})
- else
p.nodata = l :label_no_data

View file

@ -0,0 +1,27 @@
h3.icon.icon-document = l :label_document_plural
- if @can_edit
div id="#{block}-settings" style='display: none;'
= form_tag(_update_layout_setting_dashboard_path(@project, @dashboard), remote: true) do
.box
p
label
= l(:label_max_entries)
' :
= number_field_tag "settings[#{block}][max_entries]", max_entries, min: 1, max: 1000, required: true
p
= submit_tag l(:button_save)
'
= link_to_function l(:button_cancel), "$('##{block}-settings').toggle();"
- if documents.any?
= render partial: 'documents/document', collection: documents
p
- if @project
= link_to l(:label_document_view_all), project_documents_path(@project)
/- else
/ no route available
/= link_to l(:label_news_view_all), documents_path
- else
p.nodata = l :label_no_data

View file

@ -0,0 +1,23 @@
- cache render_async_cache_key(_dashboard_async_blocks_path(@project,
dashboard.async_params(block, async, settings))),
expires_in: async[:cache_expires_in],
skip_digest: true do
- feed = dashboard_feed_catcher settings[:url], settings[:max_entries]
h3
= dashboard_feed_title settings[:title], block_definition
- if feed[:valid]
- if feed[:items].count.positive?
ul.reporting-list.feed
- feed[:items].each do |item|
li
= link_to item[:title],
item[:link],
class: 'external', rel: 'noopener noreferrer', target: '_blank'
- else
p.nodata = l :label_no_data
- elsif settings[:url].blank?
p.nodata = l :label_no_data
- else
p.nodata = l(:label_invalid_feed_data)

View file

@ -0,0 +1,25 @@
- max_entries = settings[:max_entries].presence || DashboardContent::DEFAULT_MAX_ENTRIES
div id="#{block}-settings" style="#{'display: none;' if hide}"
= form_tag(_update_layout_setting_dashboard_path(@project, @dashboard), remote: true) do
.box
p
label
= l :field_title
' :
= text_field_tag "settings[#{block}][title]", dashboard_feed_title(settings[:title], block_definition)
p
label
= l :field_url
' :
= url_field_tag "settings[#{block}][url]", settings[:url], required: true
p
label
= l(:label_max_entries)
' :
= number_field_tag "settings[#{block}][max_entries]", max_entries, min: 1, max: 100, required: true
p
= submit_tag l(:button_save)
'
= link_to_function l(:button_cancel), "$('##{block}-settings').toggle();"

View file

@ -0,0 +1,35 @@
h3 = block_definition[:label]
- if @can_edit
div id="#{block}-settings" style='display: none;'
= form_tag(_update_layout_setting_dashboard_path(@project, @dashboard), remote: true) do
.box
p
label
= l :button_show
' :
= number_field_tag "settings[#{block}][days]", days, min: 1, max: 1000, required: true
'
= l :label_day_plural
p
= submit_tag l(:button_save)
'
= link_to_function l(:button_cancel), "$('#my_spent_time-settings').toggle();"
ul.reporting-list
li.today
= l :label_today
' :
= l_hours_short entries_today.sum(&:hours)
li.days
= l :label_last_n_days, days
' :
= l_hours_short entries_days.sum(&:hours)
= link_to l(:label_spent_time), _time_entries_path(@project, nil, user_id: 'me')
'
= link_to l(:button_log_time),
_new_time_entry_path(@project, nil),
class: 'icon-only icon-add',
title: l(:button_log_time)

View file

@ -0,0 +1,25 @@
h3.icon.icon-news = l :label_news_latest
- if @can_edit
div id="#{block}-settings" style='display: none;'
= form_tag(_update_layout_setting_dashboard_path(@project, @dashboard), remote: true) do
.box
p
label
= l(:label_max_entries)
' :
= number_field_tag "settings[#{block}][max_entries]", max_entries, min: 1, max: 1000, required: true
p
= submit_tag l(:button_save)
'
= link_to_function l(:button_cancel), "$('##{block}-settings').toggle();"
- if news.any?
= render partial: 'news/news', collection: news
p
- if @project
= link_to l(:label_news_view_all), project_news_index_path(@project)
- else
= link_to l(:label_news_view_all), news_index_path
- else
p.nodata = l :label_no_data

View file

@ -0,0 +1,21 @@
h3 = block_definition[:label]
- if @project.description.present?
.wiki.project-description
= textilizable @project.description
- if @project.homepage.present? || @project.visible_custom_field_values.any? { |o| o.value.present? }
ul.reporting-list
- if @project.homepage.present?
li
span.label
= l :field_homepage
' :
= link_to_if uri_with_safe_scheme?(@project.homepage), @project.homepage, @project.homepage, class: 'external'
- render_custom_field_values(@project) do |custom_field, formatted|
li class="#{custom_field.css_classes}"
span.label
= custom_field.name
' :
= formatted
= call_hook :view_projects_show_dashboard_info_block, project: @project, dashboard: dashboard

View file

@ -0,0 +1,42 @@
h3.icon.icon-issue
= l :label_issue_tracking
'
= link_to l(:label_details),
project_issues_report_details_path(@project, detail: 'tracker'),
class: 'icon-only icon-zoom-in',
title: l(:label_details)
- if @trackers.present?
table.list.issue-report
thead
tr
th
th
= l :label_open_issues_plural
th
= l :label_closed_issues_plural
th
= l :label_total
tbody
- @trackers.each do |tracker|
tr
td.name
= link_to tracker.name, project_issues_path(@project, set_filter: 1, tracker_id: tracker.id), title: tracker.description
td
= link_to @open_issues_by_tracker[tracker].to_i, project_issues_path(@project, set_filter: 1, tracker_id: tracker.id)
td
= link_to (@total_issues_by_tracker[tracker].to_i - @open_issues_by_tracker[tracker].to_i),
project_issues_path(@project, set_filter: 1, tracker_id: tracker.id, status_id: 'c')
td.total
= link_to @total_issues_by_tracker[tracker].to_i,
project_issues_path(@project, set_filter: 1, tracker_id: tracker.id, status_id: '*')
p
= link_to l(:label_issue_view_all), project_issues_path(@project, set_filter: 1)
' |
= link_to l(:field_summary), project_issues_report_path(@project)
- if User.current.allowed_to? :view_calendar, @project, global: true
' |
= link_to l(:label_calendar), project_calendar_path(@project)
- if User.current.allowed_to? :view_gantt, @project, global: true
' |
= link_to l(:label_gantt), project_gantt_path(@project)

View file

@ -0,0 +1,7 @@
- if @subprojects.any?
h3.icon.icon-projects
= l(:label_subproject_plural)
ul.subprojects
- @subprojects.each do |project|
li
= link_to(project.name, project_path(project), class: project.css_classes).html_safe

View file

@ -0,0 +1,20 @@
h3.icon.icon-time
= block_definition[:label]
ul
- if @total_estimated_hours.present?
li
= l :field_estimated_hours
' :
= l_hours @total_estimated_hours
- if @total_hours.present?
li
= l :label_spent_time
' :
= l_hours @total_hours
p
- if User.current.allowed_to? :log_time, @project
= link_to l(:button_log_time), new_project_time_entry_path(@project)
' |
= link_to l(:label_details), project_time_entries_path(@project)
' |
= link_to l(:label_report), report_project_time_entries_path(@project)

View file

@ -0,0 +1,34 @@
- cache render_async_cache_key(_dashboard_async_blocks_path(@project, dashboard.async_params(block, async, settings))),
expires_in: DashboardContent::RENDER_ASYNC_CACHE_EXPIRES_IN,
skip_digest: true do
- query = klass.visible.find_by(id: settings[:query_id])
- if query
ruby:
query.project = @project if query_block[:with_project]
count = query.send query_block[:count_method]
query.column_names = settings[:columns].split(',').map(&:to_sym) if settings[:columns].present?
query.sort_criteria = params[:sort] if params[:sort].present?
h3.query-list-block
= dashboard_query_list_block_title query, query_block, @project
= " (#{count})"
= dashboard_query_list_block_alerts dashboard, query, block_definition
- if query.respond_to?(:description) && query.description.present?
.query-description
= textilizable query, :description
- if count.positive?
/ required by some helpers of other plugins
- @query = query
= render partial: query_block[:list_partial],
locals: { query_block[:entities_var] => query.send(query_block[:entries_method],
limit: settings[:max_entries] || DashboardContent::DEFAULT_MAX_ENTRIES),
query: query,
query_options: { sort_param: 'sort',
sort_link_options: { method: :post, remote: true } } }
- else
p.nodata = l :label_no_data
- else
p.nodata = l :label_no_data

View file

@ -0,0 +1,27 @@
- query = klass.find_by id: settings[:query_id]
- query.column_names = settings[:columns].map(&:to_sym) if query && settings[:columns].present?
div id="#{block}-settings" style="#{'display: none;' if hide}"
= form_tag(_update_layout_setting_dashboard_path(@project, dashboard), remote: true) do
.box
- if query
= render_query_columns_selection query, name: "settings[#{block}][columns]"
- else
p
label
= block_definition[:label]
'
= select_tag "settings[#{block}][query_id]",
options_for_query_select(klass, @project),
required: true
p
label
= l :label_max_entries
' :
= number_field_tag "settings[#{block}][max_entries]",
settings[:max_entries].presence || DashboardContent::DEFAULT_MAX_ENTRIES,
min: 1, max: 100, required: true
p
= submit_tag l(:button_save)
'
= link_to_function l(:button_cancel), "$('##{block}-settings').toggle();"

View file

@ -0,0 +1,26 @@
ruby:
title = settings[:title] || l(:label_text)
text = settings[:text]
- if title.present?
h3 = title
- if @can_edit
div id="#{block}-settings" style='display: none;'
= form_tag(_update_layout_setting_dashboard_path(@project, @dashboard), remote: true) do
.box
p
label
= l :field_title
' :
= text_field_tag "settings[#{block}][title]", title
p
= text_area_tag "settings[#{block}][text]", text, rows: addtionals_textarea_cols(text), class: 'wiki-edit'
= wikitoolbar_for "settings_#{block}_text"
p
= submit_tag l(:button_save)
'
= link_to_function l(:button_cancel), "$('##{block}-settings').toggle();"
.wiki
= textilizable text

View file

@ -0,0 +1,2 @@
.wiki
= textilizable Setting.welcome_text

View file

@ -0,0 +1,7 @@
h2 = l(:button_dashboard_edit)
= labelled_form_for :dashboard,
@dashboard,
url: { action: 'update', id: @dashboard.id },
html: { multipart: true, method: :put, id: 'dashboard-form' } do |f|
= render partial: 'form', locals: { f: f }
= submit_tag l(:button_save)

View file

@ -0,0 +1,20 @@
api.array :dashboards, api_meta(total_count: @query_count, offset: @offset, limit: @limit) do
@dashboards.each do |dashboard|
api.dashboard do
api.id dashboard.id
api.name dashboard.name
api.dashboard_type dashboard.dashboard_type
api.description dashboard.description
api.enable_sidebar dashboard.enable_sidebar
api.system_default dashboard.system_default
api.always_expose dashboard.always_expose
api.project(id: dashboard.project_id, name: dashboard.project.name) unless dashboard.project.nil?
api.author id: dashboard.author_id, name: dashboard.author.name
api.visibility dashboard.visibility
api.created_on dashboard.created_at
api.updated_on dashboard.updated_at
call_hook :api_dashboard_show, dashboard: dashboard
end
end
end

View file

@ -0,0 +1,7 @@
h2 = l(:label_new_additional_dashboard)
= labelled_form_for :dashboard,
@dashboard,
url: { action: 'create', project_id: @project },
html: { multipart: true, id: 'dashboard-form' } do |f|
= render partial: 'form', locals: { f: f }
= submit_tag l(:button_save)

View file

@ -0,0 +1,2 @@
$("#block-<%= escape_javascript @block %>").remove();
$("#block-select").replaceWith("<%= escape_javascript dashboard_block_select_tag(@dashboard) %>");

View file

@ -0,0 +1,17 @@
api.dashboard do
api.id @dashboard.id
api.name @dashboard.name
api.dashboard_type @dashboard.dashboard_type
api.description @dashboard.description
api.enable_sidebar @dashboard.enable_sidebar
api.system_default @dashboard.system_default
api.always_expose @dashboard.always_expose
api.project(id: @dashboard.project_id, name: @dashboard.project.name) unless @dashboard.project.nil?
api.author id: @dashboard.author_id, name: @dashboard.author.name
api.visibility @dashboard.visibility
api.options @dashboard.options
api.created_on @dashboard.created_at
api.updated_on @dashboard.updated_at
call_hook :api_dashboard_show, dashboard: @dashboard
end

View file

@ -0,0 +1,14 @@
<% @updated_blocks.each do |block| %>
$("#block-<%= block %>").replaceWith("<%= escape_javascript render_dashboard_block(block.to_s, @dashboard) %>");
<% end %>
$('[title]').tooltip({
show: {
delay: 400
},
position: {
my: "center bottom-5",
at: "center top"
}
});