Merge pull request #3359 from consul/translations
Translate user generated content
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -49,6 +49,7 @@ gem "savon", "~> 2.12.0"
|
||||
gem "sitemap_generator", "~> 6.0.1"
|
||||
gem "social-share-button", "~> 1.1"
|
||||
gem "sprockets", "~> 3.7.2"
|
||||
gem "translator-text", "~> 0.1.0"
|
||||
gem "turbolinks", "~> 2.5.3"
|
||||
gem "turnout", "~> 2.4.0"
|
||||
gem "uglifier", "~> 4.1.2"
|
||||
|
||||
33
Gemfile.lock
33
Gemfile.lock
@@ -168,6 +168,31 @@ GEM
|
||||
devise (>= 4.0)
|
||||
diff-lcs (1.3)
|
||||
docile (1.3.1)
|
||||
dry-configurable (0.7.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-container (0.6.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-configurable (~> 0.1, >= 0.1.3)
|
||||
dry-core (0.4.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-equalizer (0.2.1)
|
||||
dry-inflector (0.1.2)
|
||||
dry-logic (0.4.2)
|
||||
dry-container (~> 0.2, >= 0.2.6)
|
||||
dry-core (~> 0.2)
|
||||
dry-equalizer (~> 0.2)
|
||||
dry-struct (0.5.1)
|
||||
dry-core (~> 0.4, >= 0.4.3)
|
||||
dry-equalizer (~> 0.2)
|
||||
dry-types (~> 0.13)
|
||||
ice_nine (~> 0.11)
|
||||
dry-types (0.13.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-container (~> 0.3)
|
||||
dry-core (~> 0.4, >= 0.4.4)
|
||||
dry-equalizer (~> 0.2)
|
||||
dry-inflector (~> 0.1, >= 0.1.2)
|
||||
dry-logic (~> 0.4, >= 0.4.2)
|
||||
email_spec (2.1.1)
|
||||
htmlentities (~> 4.3.3)
|
||||
launchy (~> 2.1)
|
||||
@@ -223,6 +248,9 @@ GEM
|
||||
highline (2.0.0)
|
||||
html_tokenizer (0.0.7)
|
||||
htmlentities (4.3.4)
|
||||
httparty (0.17.0)
|
||||
mime-types (~> 3.0)
|
||||
multi_xml (>= 0.5.2)
|
||||
httpi (2.4.4)
|
||||
rack
|
||||
socksify
|
||||
@@ -237,6 +265,7 @@ GEM
|
||||
parser (>= 2.2.3.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
terminal-table (>= 1.5.1)
|
||||
ice_nine (0.11.2)
|
||||
initialjs-rails (0.2.0.5)
|
||||
railties (>= 3.1, < 6.0)
|
||||
invisible_captcha (0.10.0)
|
||||
@@ -493,6 +522,9 @@ GEM
|
||||
tilt (2.0.8)
|
||||
tins (1.16.3)
|
||||
tomlrb (1.2.7)
|
||||
translator-text (0.1.0)
|
||||
dry-struct (~> 0.5.0)
|
||||
httparty (~> 0.15)
|
||||
turbolinks (2.5.4)
|
||||
coffee-rails
|
||||
turnout (2.4.1)
|
||||
@@ -614,6 +646,7 @@ DEPENDENCIES
|
||||
spring (~> 2.0.1)
|
||||
spring-commands-rspec (~> 1.0.4)
|
||||
sprockets (~> 3.7.2)
|
||||
translator-text (~> 0.1.0)
|
||||
turbolinks (~> 2.5.3)
|
||||
turnout (~> 2.4.0)
|
||||
uglifier (~> 4.1.2)
|
||||
|
||||
@@ -40,14 +40,15 @@ App.Forms =
|
||||
hideOrShowFieldsAfterSelection: ->
|
||||
$("[name='progress_bar[kind]']").on
|
||||
change: ->
|
||||
title_field = $("[name^='progress_bar'][name$='[title]']").parent()
|
||||
locale = App.Globalize.selected_language()
|
||||
title_field = $(".translatable-fields[data-locale=#{locale}]")
|
||||
|
||||
if this.value == "primary"
|
||||
title_field.hide()
|
||||
$("#globalize_locales").hide()
|
||||
$(".globalize-languages").hide()
|
||||
else
|
||||
title_field.show()
|
||||
$("#globalize_locales").show()
|
||||
$(".globalize-languages").show()
|
||||
|
||||
$("[name='progress_bar[kind]']").change()
|
||||
|
||||
|
||||
@@ -1,37 +1,47 @@
|
||||
App.Globalize =
|
||||
|
||||
selected_language: ->
|
||||
$("#select_language").val()
|
||||
|
||||
display_locale: (locale) ->
|
||||
App.Globalize.enable_locale(locale)
|
||||
$(".js-globalize-locale-link").each ->
|
||||
if $(this).data("locale") == locale
|
||||
$(this).show()
|
||||
App.Globalize.highlight_locale($(this))
|
||||
$(".js-globalize-locale option:selected").removeAttr("selected")
|
||||
return
|
||||
App.Globalize.add_language(locale)
|
||||
$(".js-add-language option:selected").removeAttr("selected")
|
||||
|
||||
display_translations: (locale) ->
|
||||
$(".js-select-language option[value=#{locale}]").prop("selected", true)
|
||||
$(".js-globalize-attribute").each ->
|
||||
if $(this).data("locale") == locale
|
||||
$(this).show()
|
||||
else
|
||||
$(this).hide()
|
||||
$(".js-delete-language").hide()
|
||||
$("#js_delete_#{locale}").show()
|
||||
$(".js-delete-" + locale).show()
|
||||
|
||||
highlight_locale: (element) ->
|
||||
$(".js-globalize-locale-link").removeClass("is-active")
|
||||
element.addClass("is-active")
|
||||
add_language: (locale) ->
|
||||
language_option = $(".js-add-language [value=#{locale}]")
|
||||
if $(".js-select-language option[value=#{locale}]").length == 0
|
||||
option = new Option(language_option.text(), language_option.val())
|
||||
$(".js-select-language").append(option)
|
||||
$(".js-select-language option[value=#{locale}]").prop("selected", true)
|
||||
|
||||
remove_language: (locale) ->
|
||||
$(".js-globalize-attribute[data-locale=#{locale}]").each ->
|
||||
$(this).val("").hide()
|
||||
if CKEDITOR.instances[$(this).attr("id")]
|
||||
CKEDITOR.instances[$(this).attr("id")].setData("")
|
||||
$(".js-globalize-locale-link[data-locale=#{locale}]").hide()
|
||||
next = $(".js-globalize-locale-link:visible").first()
|
||||
App.Globalize.highlight_locale(next)
|
||||
App.Globalize.display_translations(next.data("locale"))
|
||||
App.Globalize.resetEditor(this)
|
||||
|
||||
$(".js-select-language option[value=#{locale}]").remove()
|
||||
next = $(".js-select-language option:not([value=''])").first()
|
||||
App.Globalize.display_translations(next.val())
|
||||
App.Globalize.disable_locale(locale)
|
||||
App.Globalize.update_description()
|
||||
|
||||
if $(".js-select-language option").length == 1
|
||||
$(".js-select-language option").prop("selected", true)
|
||||
|
||||
resetEditor: (element) ->
|
||||
if CKEDITOR.instances[$(element).attr("id")]
|
||||
CKEDITOR.instances[$(element).attr("id")].setData("")
|
||||
|
||||
enable_locale: (locale) ->
|
||||
App.Globalize.destroy_locale_field(locale).val(false)
|
||||
@@ -43,8 +53,8 @@ App.Globalize =
|
||||
|
||||
enabled_locales: ->
|
||||
$.map(
|
||||
$(".js-globalize-locale-link:visible"),
|
||||
(element) -> $(element).data("locale")
|
||||
$(".js-select-language:first option:not([value=''])"),
|
||||
(element) -> $(element).val()
|
||||
)
|
||||
|
||||
destroy_locale_field: (locale) ->
|
||||
@@ -54,20 +64,34 @@ App.Globalize =
|
||||
$("#enabled_translations_#{locale}")
|
||||
|
||||
refresh_visible_translations: ->
|
||||
locale = $(".js-globalize-locale-link.is-active").data("locale")
|
||||
locale = $(".js-select-language").val()
|
||||
App.Globalize.display_translations(locale)
|
||||
|
||||
update_description: ->
|
||||
count = App.Globalize.enabled_locales().length
|
||||
description = App.Globalize.language_description(count)
|
||||
$(".js-languages-description").html(description)
|
||||
$(".js-languages-count").text(count)
|
||||
|
||||
language_description: (count) ->
|
||||
switch count
|
||||
when 0 then $(".globalize-languages").data("zero-languages-description")
|
||||
when 1 then $(".globalize-languages").data("one-languages-description")
|
||||
else $(".globalize-languages").data("other-languages-description")
|
||||
|
||||
initialize: ->
|
||||
$(".js-globalize-locale").on "change", ->
|
||||
App.Globalize.display_translations($(this).val())
|
||||
App.Globalize.display_locale($(this).val())
|
||||
|
||||
$(".js-globalize-locale-link").on "click", ->
|
||||
locale = $(this).data("locale")
|
||||
$(".js-add-language").on "change", ->
|
||||
locale = $(this).val()
|
||||
App.Globalize.display_translations(locale)
|
||||
App.Globalize.highlight_locale($(this))
|
||||
App.Globalize.display_locale(locale)
|
||||
App.Globalize.update_description()
|
||||
|
||||
$(".js-delete-language").on "click", ->
|
||||
$(".js-select-language").on "change", ->
|
||||
locale = $(this).val()
|
||||
App.Globalize.display_translations(locale)
|
||||
|
||||
$(".js-delete-language").on "click", (e) ->
|
||||
e.preventDefault()
|
||||
locale = $(this).data("locale")
|
||||
$(this).hide()
|
||||
App.Globalize.remove_language(locale)
|
||||
|
||||
@@ -9,11 +9,15 @@ App.Suggest =
|
||||
callback = ->
|
||||
$.ajax
|
||||
url: $this.data("js-url")
|
||||
data: { search: $this.val() },
|
||||
type: "GET",
|
||||
data:
|
||||
search: $this.val()
|
||||
type: "GET"
|
||||
dataType: "html"
|
||||
success: (stHtml) ->
|
||||
js_suggest_selector = $this.data("js-suggest")
|
||||
if js_suggest_selector.startsWith(".")
|
||||
locale = $this.closest(".translatable-fields").data("locale")
|
||||
js_suggest_selector += "[data-locale=#{locale}]"
|
||||
$(js_suggest_selector).html(stHtml)
|
||||
|
||||
timer = null
|
||||
|
||||
@@ -197,6 +197,10 @@ a {
|
||||
padding-top: $line-height;
|
||||
}
|
||||
|
||||
.padding-top {
|
||||
padding-top: $line-height;
|
||||
}
|
||||
|
||||
.light {
|
||||
background: $light;
|
||||
}
|
||||
@@ -474,6 +478,26 @@ header {
|
||||
}
|
||||
}
|
||||
|
||||
.remote-translations-button {
|
||||
|
||||
&.callout {
|
||||
margin: 0;
|
||||
padding: rem-calc(6);
|
||||
|
||||
[type="submit"] {
|
||||
background: none;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
color: $brand;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.external-links {
|
||||
float: none;
|
||||
padding: rem-calc(6) 0;
|
||||
@@ -1060,6 +1084,19 @@ form {
|
||||
}
|
||||
}
|
||||
|
||||
.translatable-fields {
|
||||
|
||||
&.highlight {
|
||||
display: inline-block;
|
||||
padding-top: $line-height;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.translation-locale {
|
||||
padding-top: $line-height;
|
||||
}
|
||||
|
||||
// 07. Callout
|
||||
// -----------
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
||||
include CommentableActions
|
||||
include DownloadSettingsHelper
|
||||
include ChangeLogHelper
|
||||
include Translatable
|
||||
|
||||
feature_flag :budgets
|
||||
|
||||
@@ -81,17 +82,16 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def load_investments
|
||||
@investments = Budget::Investment.scoped_filter(params, @current_filter)
|
||||
.order_filter(params)
|
||||
|
||||
@investments = Budget::Investment.scoped_filter(params, @current_filter).order_filter(params)
|
||||
@investments = Kaminari.paginate_array(@investments) if @investments.kind_of?(Array)
|
||||
@investments = @investments.page(params[:page]) unless request.format.csv?
|
||||
end
|
||||
|
||||
def budget_investment_params
|
||||
params.require(:budget_investment)
|
||||
.permit(:title, :description, :external_url, :heading_id, :administrator_id, :tag_list,
|
||||
attributes = [:external_url, :heading_id, :administrator_id, :tag_list,
|
||||
:valuation_tag_list, :incompatible, :visible_to_valuators, :selected,
|
||||
:milestone_tag_list, tracker_ids: [], valuator_ids: [], valuator_group_ids: [])
|
||||
:milestone_tag_list, tracker_ids: [], valuator_ids: [], valuator_group_ids: []]
|
||||
params.require(:budget_investment).permit(attributes, translation_params(Budget::Investment))
|
||||
end
|
||||
|
||||
def load_budget
|
||||
|
||||
@@ -19,7 +19,7 @@ class Admin::HiddenBudgetInvestmentsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def restore
|
||||
@investment.restore
|
||||
@investment.restore(recursive: true)
|
||||
@investment.ignore_flag
|
||||
Activity.log(current_user, :restore, @investment)
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
|
||||
@@ -14,7 +14,7 @@ class Admin::HiddenCommentsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def restore
|
||||
@comment.restore
|
||||
@comment.restore(recursive: true)
|
||||
@comment.ignore_flag
|
||||
Activity.log(current_user, :restore, @comment)
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
|
||||
@@ -17,7 +17,7 @@ class Admin::HiddenDebatesController < Admin::BaseController
|
||||
end
|
||||
|
||||
def restore
|
||||
@debate.restore
|
||||
@debate.restore!(recursive: true)
|
||||
@debate.ignore_flag
|
||||
Activity.log(current_user, :restore, @debate)
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
|
||||
@@ -18,7 +18,7 @@ class Admin::HiddenProposalsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def restore
|
||||
@proposal.restore
|
||||
@proposal.restore(recursive: true)
|
||||
@proposal.ignore_flag
|
||||
Activity.log(current_user, :restore, @proposal)
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
require "application_responder"
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
include GlobalizeFallbacks
|
||||
include HasFilters
|
||||
include HasOrders
|
||||
include AccessDeniedHandler
|
||||
@@ -14,7 +15,6 @@ class ApplicationController < ActionController::Base
|
||||
before_action :track_email_campaign
|
||||
before_action :set_return_url
|
||||
before_action :set_current_user
|
||||
before_action :set_fallbacks_to_all_available_locales
|
||||
|
||||
check_authorization unless: :devise_controller?
|
||||
self.responder = ApplicationResponder
|
||||
@@ -124,8 +124,4 @@ class ApplicationController < ActionController::Base
|
||||
def set_current_user
|
||||
User.current_user = current_user
|
||||
end
|
||||
|
||||
def set_fallbacks_to_all_available_locales
|
||||
Globalize.set_fallbacks_to_all_available_locales
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,6 +6,7 @@ module Budgets
|
||||
include FlagActions
|
||||
include RandomSeed
|
||||
include ImageAttributes
|
||||
include Translatable
|
||||
|
||||
PER_PAGE = 10
|
||||
|
||||
@@ -48,6 +49,7 @@ module Budgets
|
||||
|
||||
load_investment_votes(@investments)
|
||||
@tag_cloud = tag_cloud
|
||||
@remote_translations = detect_remote_translations(@investments)
|
||||
end
|
||||
|
||||
def new
|
||||
@@ -60,6 +62,7 @@ module Budgets
|
||||
set_comment_flags(@comment_tree.comments)
|
||||
load_investment_votes(@investment)
|
||||
@investment_ids = [@investment.id]
|
||||
@remote_translations = detect_remote_translations([@investment], @comment_tree.comments)
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -122,12 +125,12 @@ module Budgets
|
||||
end
|
||||
|
||||
def investment_params
|
||||
params.require(:budget_investment)
|
||||
.permit(:title, :description, :heading_id, :tag_list,
|
||||
attributes = [:heading_id, :tag_list,
|
||||
:organization_name, :location, :terms_of_service, :skip_map,
|
||||
image_attributes: image_attributes,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
|
||||
map_location_attributes: [:latitude, :longitude, :zoom])
|
||||
map_location_attributes: [:latitude, :longitude, :zoom]]
|
||||
params.require(:budget_investment).permit(attributes, translation_params(Budget::Investment))
|
||||
end
|
||||
|
||||
def load_ballot
|
||||
|
||||
@@ -3,6 +3,7 @@ module CommentableActions
|
||||
include Polymorphic
|
||||
include Search
|
||||
include DownloadSettingsHelper
|
||||
include RemotelyTranslatable
|
||||
|
||||
def index
|
||||
@resources = resource_model.all
|
||||
@@ -23,6 +24,8 @@ module CommentableActions
|
||||
set_resource_votes(@resources)
|
||||
|
||||
set_resources_instance
|
||||
@remote_translations = detect_remote_translations(@resources, featured_proposals)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.csv {send_data to_csv(resources_csv, resource_model),
|
||||
@@ -38,6 +41,7 @@ module CommentableActions
|
||||
@comment_tree = CommentTree.new(@commentable, params[:page], @current_order)
|
||||
set_comment_flags(@comment_tree.comments)
|
||||
set_resource_instance
|
||||
@remote_translations = detect_remote_translations([@resource], @comment_tree.comments)
|
||||
end
|
||||
|
||||
def new
|
||||
@@ -132,4 +136,7 @@ module CommentableActions
|
||||
end
|
||||
end
|
||||
|
||||
def featured_proposals
|
||||
@featured_proposals ||= []
|
||||
end
|
||||
end
|
||||
|
||||
13
app/controllers/concerns/globalize_fallbacks.rb
Normal file
13
app/controllers/concerns/globalize_fallbacks.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
module GlobalizeFallbacks
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_action :initialize_globalize_fallbacks
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def initialize_globalize_fallbacks
|
||||
Globalize.set_fallbacks_to_all_available_locales
|
||||
end
|
||||
end
|
||||
29
app/controllers/concerns/remotely_translatable.rb
Normal file
29
app/controllers/concerns/remotely_translatable.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
module RemotelyTranslatable
|
||||
|
||||
private
|
||||
|
||||
def detect_remote_translations(*args)
|
||||
return [] unless Setting["feature.remote_translations"].present?
|
||||
|
||||
resources_groups(*args).flatten.select { |resource| translation_empty?(resource) }.map do |resource|
|
||||
remote_translation_for(resource)
|
||||
end
|
||||
end
|
||||
|
||||
def remote_translation_for(resource)
|
||||
{ "remote_translatable_id" => resource.id.to_s,
|
||||
"remote_translatable_type" => resource.class.to_s,
|
||||
"locale" => I18n.locale }
|
||||
end
|
||||
|
||||
def translation_empty?(resource)
|
||||
resource.translations.where(locale: I18n.locale).empty?
|
||||
end
|
||||
|
||||
def resources_groups(*args)
|
||||
feeds = args.detect { |arg| arg&.first.class == Widget::Feed } || []
|
||||
|
||||
args.compact - [feeds] + feeds.map(&:items)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -3,10 +3,13 @@ module Translatable
|
||||
|
||||
private
|
||||
|
||||
def translation_params(resource_model)
|
||||
{
|
||||
translations_attributes: [:id, :_destroy, :locale] +
|
||||
resource_model.translated_attribute_names
|
||||
}
|
||||
def translation_params(resource_model, options = {})
|
||||
attributes = [:id, :locale, :_destroy]
|
||||
if options[:only]
|
||||
attributes += [*options[:only]]
|
||||
else
|
||||
attributes += resource_model.translated_attribute_names
|
||||
end
|
||||
{ translations_attributes: attributes - [*options[:except]] }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ class DebatesController < ApplicationController
|
||||
include FeatureFlags
|
||||
include CommentableActions
|
||||
include FlagActions
|
||||
include Translatable
|
||||
|
||||
before_action :parse_tag_filter, only: :index
|
||||
before_action :authenticate_user!, except: [:index, :show, :map]
|
||||
@@ -55,7 +56,8 @@ class DebatesController < ApplicationController
|
||||
private
|
||||
|
||||
def debate_params
|
||||
params.require(:debate).permit(:title, :description, :tag_list, :terms_of_service)
|
||||
attributes = [:tag_list, :terms_of_service]
|
||||
params.require(:debate).permit(attributes, translation_params(Debate))
|
||||
end
|
||||
|
||||
def resource_model
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Management::BaseController < ActionController::Base
|
||||
include GlobalizeFallbacks
|
||||
layout "management"
|
||||
|
||||
before_action :verify_manager
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Management::Budgets::InvestmentsController < Management::BaseController
|
||||
include Translatable
|
||||
before_action :load_budget
|
||||
|
||||
load_resource :budget
|
||||
@@ -53,8 +54,8 @@ class Management::Budgets::InvestmentsController < Management::BaseController
|
||||
end
|
||||
|
||||
def investment_params
|
||||
params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id,
|
||||
:tag_list, :organization_name, :location, :skip_map)
|
||||
attributes = [:external_url, :heading_id, :tag_list, :organization_name, :location, :skip_map]
|
||||
params.require(:budget_investment).permit(attributes, translation_params(Budget::Investment))
|
||||
end
|
||||
|
||||
def only_verified_users
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Management::ProposalsController < Management::BaseController
|
||||
include HasOrders
|
||||
include CommentableActions
|
||||
include Translatable
|
||||
|
||||
before_action :only_verified_users, except: :print
|
||||
before_action :set_proposal, only: [:vote, :show]
|
||||
@@ -52,10 +53,10 @@ class Management::ProposalsController < Management::BaseController
|
||||
end
|
||||
|
||||
def proposal_params
|
||||
params.require(:proposal).permit(:title, :summary, :description, :video_url,
|
||||
:responsible_name, :tag_list, :terms_of_service, :geozone_id,
|
||||
:skip_map,
|
||||
map_location_attributes: [:latitude, :longitude, :zoom])
|
||||
attributes = [:video_url, :responsible_name, :tag_list,
|
||||
:terms_of_service, :geozone_id,
|
||||
:skip_map, map_location_attributes: [:latitude, :longitude, :zoom]]
|
||||
params.require(:proposal).permit(attributes, translation_params(Proposal))
|
||||
end
|
||||
|
||||
def resource_model
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
require "manager_authenticator"
|
||||
|
||||
class Management::SessionsController < ActionController::Base
|
||||
include GlobalizeFallbacks
|
||||
include AccessDeniedHandler
|
||||
|
||||
def create
|
||||
|
||||
@@ -3,6 +3,7 @@ class ProposalsController < ApplicationController
|
||||
include CommentableActions
|
||||
include FlagActions
|
||||
include ImageAttributes
|
||||
include Translatable
|
||||
|
||||
before_action :parse_tag_filter, only: :index
|
||||
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
|
||||
@@ -37,7 +38,6 @@ class ProposalsController < ApplicationController
|
||||
|
||||
def create
|
||||
@proposal = Proposal.new(proposal_params.merge(author: current_user))
|
||||
|
||||
if @proposal.save
|
||||
redirect_to created_proposal_path(@proposal), notice: I18n.t("flash.actions.create.proposal")
|
||||
else
|
||||
@@ -62,7 +62,7 @@ class ProposalsController < ApplicationController
|
||||
end
|
||||
|
||||
def retire
|
||||
if valid_retired_params? && @proposal.update(retired_params.merge(retired_at: Time.current))
|
||||
if @proposal.update(retired_params.merge(retired_at: Time.current))
|
||||
redirect_to proposal_path(@proposal), notice: t("proposals.notice.retired")
|
||||
else
|
||||
render action: :retire_form
|
||||
@@ -98,22 +98,20 @@ class ProposalsController < ApplicationController
|
||||
private
|
||||
|
||||
def proposal_params
|
||||
params.require(:proposal).permit(:title, :summary, :description, :video_url,
|
||||
:responsible_name, :tag_list, :terms_of_service,
|
||||
:geozone_id, :skip_map, image_attributes: image_attributes,
|
||||
documents_attributes: [:id, :title, :attachment,
|
||||
:cached_attachment, :user_id, :_destroy],
|
||||
map_location_attributes: [:latitude, :longitude, :zoom])
|
||||
attributes = [:video_url,:responsible_name, :tag_list,
|
||||
:terms_of_service, :geozone_id, :skip_map,
|
||||
image_attributes: image_attributes,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment,
|
||||
:user_id, :_destroy],
|
||||
map_location_attributes: [:latitude, :longitude, :zoom]]
|
||||
translations_attributes = translation_params(Proposal, except: :retired_explanation)
|
||||
params.require(:proposal).permit(attributes, translations_attributes)
|
||||
end
|
||||
|
||||
def retired_params
|
||||
params.require(:proposal).permit(:retired_reason, :retired_explanation)
|
||||
end
|
||||
|
||||
def valid_retired_params?
|
||||
@proposal.errors.add(:retired_reason, I18n.t("errors.messages.blank")) if params[:proposal][:retired_reason].blank?
|
||||
@proposal.errors.add(:retired_explanation, I18n.t("errors.messages.blank")) if params[:proposal][:retired_explanation].blank?
|
||||
@proposal.errors.empty?
|
||||
attributes = [:retired_reason]
|
||||
translations_attributes = translation_params(Proposal, only: :retired_explanation)
|
||||
params.require(:proposal).permit(attributes, translations_attributes)
|
||||
end
|
||||
|
||||
def resource_model
|
||||
|
||||
34
app/controllers/remote_translations_controller.rb
Normal file
34
app/controllers/remote_translations_controller.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
class RemoteTranslationsController < ApplicationController
|
||||
skip_authorization_check
|
||||
respond_to :html, :js
|
||||
|
||||
before_action :set_remote_translations, only: :create
|
||||
|
||||
def create
|
||||
@remote_translations.each do |remote_translation|
|
||||
RemoteTranslation.create(remote_translation) unless translations_enqueued?(remote_translation)
|
||||
end
|
||||
redirect_to request.referer, notice: t("remote_translations.create.enqueue_remote_translation")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def remote_translations_params
|
||||
params.permit(:remote_translations)
|
||||
end
|
||||
|
||||
def set_remote_translations
|
||||
remote_translations = remote_translations_params["remote_translations"]
|
||||
decoded_remote_translations = ActiveSupport::JSON.decode(remote_translations)
|
||||
@remote_translations = decoded_remote_translations.map{ |remote_translation|
|
||||
remote_translation.slice("remote_translatable_id",
|
||||
"remote_translatable_type",
|
||||
"locale")
|
||||
}
|
||||
end
|
||||
|
||||
def translations_enqueued?(remote_translation)
|
||||
RemoteTranslation.remote_translation_enqueued?(remote_translation)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,6 @@
|
||||
class WelcomeController < ApplicationController
|
||||
include RemotelyTranslatable
|
||||
|
||||
skip_authorization_check
|
||||
before_action :set_user_recommendations, only: :index, if: :current_user
|
||||
before_action :authenticate_user!, only: :welcome
|
||||
@@ -10,6 +12,9 @@ class WelcomeController < ApplicationController
|
||||
@feeds = Widget::Feed.active
|
||||
@cards = Widget::Card.body
|
||||
@banners = Banner.in_section("homepage").with_active
|
||||
@remote_translations = detect_remote_translations(@feeds,
|
||||
@recommended_debates,
|
||||
@recommended_proposals)
|
||||
end
|
||||
|
||||
def welcome
|
||||
|
||||
@@ -1,46 +1,134 @@
|
||||
module GlobalizeHelper
|
||||
|
||||
def options_for_locale_select
|
||||
options_for_select(locale_options, nil)
|
||||
def options_for_select_language(resource)
|
||||
options_for_select(available_locales(resource), selected_locale(resource))
|
||||
end
|
||||
|
||||
def locale_options
|
||||
I18n.available_locales.map do |locale|
|
||||
[name_for_locale(locale), locale]
|
||||
def available_locales(resource)
|
||||
I18n.available_locales.select{ |locale| enabled_locale?(resource, locale) }.map do |locale|
|
||||
[name_for_locale(locale), locale , { data: { locale: locale } }]
|
||||
end
|
||||
end
|
||||
|
||||
def display_translation?(resource, locale)
|
||||
if !resource || resource.translations.blank? ||
|
||||
resource.locales_not_marked_for_destruction.include?(I18n.locale)
|
||||
locale == I18n.locale
|
||||
def enabled_locale?(resource, locale)
|
||||
return site_customization_enable_translation?(locale) if resource.blank?
|
||||
|
||||
if resource.locales_not_marked_for_destruction.any?
|
||||
resource.locales_not_marked_for_destruction.include?(locale)
|
||||
elsif resource.locales_persisted_and_marked_for_destruction.any?
|
||||
locale == first_marked_for_destruction_translation(resource)
|
||||
else
|
||||
locale == resource.translations.first.locale
|
||||
locale == I18n.locale
|
||||
end
|
||||
end
|
||||
|
||||
def selected_locale(resource)
|
||||
return first_i18n_content_translation_locale if resource.blank?
|
||||
|
||||
if resource.locales_not_marked_for_destruction.any?
|
||||
first_translation(resource)
|
||||
elsif resource.locales_persisted_and_marked_for_destruction.any?
|
||||
first_marked_for_destruction_translation(resource)
|
||||
else
|
||||
I18n.locale
|
||||
end
|
||||
end
|
||||
|
||||
def first_i18n_content_translation_locale
|
||||
if I18nContentTranslation.existing_languages.count == 0 ||
|
||||
I18nContentTranslation.existing_languages.include?(I18n.locale)
|
||||
I18n.locale
|
||||
else
|
||||
I18nContentTranslation.existing_languages.first
|
||||
end
|
||||
end
|
||||
|
||||
def first_translation(resource)
|
||||
if resource.locales_not_marked_for_destruction.include? I18n.locale
|
||||
I18n.locale
|
||||
else
|
||||
resource.locales_not_marked_for_destruction.first
|
||||
end
|
||||
end
|
||||
|
||||
def first_marked_for_destruction_translation(resource)
|
||||
if resource.locales_persisted_and_marked_for_destruction.include? I18n.locale
|
||||
I18n.locale
|
||||
else
|
||||
resource.locales_persisted_and_marked_for_destruction.first
|
||||
end
|
||||
end
|
||||
|
||||
def translations_for_locale?(resource)
|
||||
resource.locales_not_marked_for_destruction.any?
|
||||
end
|
||||
|
||||
def selected_languages_description(resource)
|
||||
t("shared.translations.languages_in_use_html", count: active_languages_count(resource))
|
||||
end
|
||||
|
||||
def select_language_error(resource)
|
||||
return if resource.blank?
|
||||
|
||||
current_translation = resource.translation_for(selected_locale(resource))
|
||||
if current_translation.errors.added? :base, :translations_too_short
|
||||
content_tag :div, class: "small error" do
|
||||
current_translation.errors[:base].join(", ")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def active_languages_count(resource)
|
||||
if resource.blank?
|
||||
no_resource_languages_count
|
||||
elsif resource.locales_not_marked_for_destruction.size > 0
|
||||
resource.locales_not_marked_for_destruction.size
|
||||
else
|
||||
1
|
||||
end
|
||||
end
|
||||
|
||||
def no_resource_languages_count
|
||||
count = I18nContentTranslation.existing_languages.count
|
||||
count > 0 ? count : 1
|
||||
end
|
||||
|
||||
def display_translation_style(resource, locale)
|
||||
"display: none;" unless display_translation?(resource, locale)
|
||||
end
|
||||
|
||||
def translation_enabled_tag(locale, enabled)
|
||||
hidden_field_tag("enabled_translations[#{locale}]", (enabled ? 1 : 0))
|
||||
end
|
||||
def display_translation?(resource, locale)
|
||||
return locale == I18n.locale if resource.blank?
|
||||
|
||||
def enable_translation_style(resource, locale)
|
||||
"display: none;" unless enable_locale?(resource, locale)
|
||||
end
|
||||
|
||||
def enable_locale?(resource, locale)
|
||||
if resource.translations.any?
|
||||
resource.locales_not_marked_for_destruction.include?(locale)
|
||||
if resource.locales_not_marked_for_destruction.any?
|
||||
locale == first_translation(resource)
|
||||
elsif resource.locales_persisted_and_marked_for_destruction.any?
|
||||
locale == first_marked_for_destruction_translation(resource)
|
||||
else
|
||||
locale == I18n.locale
|
||||
end
|
||||
end
|
||||
|
||||
def highlight_class(resource, locale)
|
||||
"is-active" if display_translation?(resource, locale)
|
||||
def display_destroy_locale_style(resource, locale)
|
||||
"display: none;" unless display_destroy_locale_link?(resource, locale)
|
||||
end
|
||||
|
||||
def display_destroy_locale_link?(resource, locale)
|
||||
selected_locale(resource) == locale
|
||||
end
|
||||
|
||||
def options_for_add_language
|
||||
options_for_select(all_language_options, nil)
|
||||
end
|
||||
|
||||
def all_language_options
|
||||
I18n.available_locales.map do |locale|
|
||||
[name_for_locale(locale), locale]
|
||||
end
|
||||
end
|
||||
|
||||
def translation_enabled_tag(locale, enabled)
|
||||
hidden_field_tag("enabled_translations[#{locale}]", (enabled ? 1 : 0))
|
||||
end
|
||||
|
||||
def globalize(locale, &block)
|
||||
@@ -48,9 +136,4 @@ module GlobalizeHelper
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def same_locale?(locale1, locale2)
|
||||
locale1 == locale2
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -64,6 +64,10 @@ module ProposalsHelper
|
||||
proposals_current_view == "default" ? "minimal" : "default"
|
||||
end
|
||||
|
||||
def summary_help_text_id(translations_form)
|
||||
"summary-help-text-#{translations_form.locale}"
|
||||
end
|
||||
|
||||
def link_to_toggle_proposal_selection(proposal)
|
||||
if proposal.selected?
|
||||
button_text = t("admin.proposals.index.selected")
|
||||
|
||||
12
app/helpers/remote_translations_helper.rb
Normal file
12
app/helpers/remote_translations_helper.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
module RemoteTranslationsHelper
|
||||
|
||||
def display_remote_translation_info?(remote_translations, locale)
|
||||
remote_translations.present? && RemoteTranslations::Microsoft::AvailableLocales.include_locale?(locale)
|
||||
end
|
||||
|
||||
def display_remote_translation_button?(remote_translations)
|
||||
remote_translations.none? do |remote_translation|
|
||||
RemoteTranslation.remote_translation_enqueued?(remote_translation)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -8,6 +8,7 @@ module TextWithLinksHelper
|
||||
|
||||
def safe_html_with_links(html)
|
||||
return if html.nil?
|
||||
html = ActiveSupport::SafeBuffer.new(html) if html.is_a?(String)
|
||||
return html.html_safe unless html.html_safe?
|
||||
Rinku.auto_link(html, :all, 'target="_blank" rel="nofollow"').html_safe
|
||||
end
|
||||
|
||||
@@ -6,15 +6,27 @@ module TranslatableFormHelper
|
||||
end
|
||||
end
|
||||
|
||||
def translations_interface_enabled?
|
||||
Setting["feature.translation_interface"].present? || backend_translations_enabled?
|
||||
end
|
||||
|
||||
def backend_translations_enabled?
|
||||
(controller.class.parents & [Admin, Management, Valuation, Tracking]).any?
|
||||
end
|
||||
|
||||
def highlight_translation_html_class
|
||||
"highlight" if translations_interface_enabled?
|
||||
end
|
||||
|
||||
class TranslatableFormBuilder < FoundationRailsHelper::FormBuilder
|
||||
attr_accessor :translations
|
||||
|
||||
def translatable_fields(&block)
|
||||
@translations = {}
|
||||
@object.globalize_locales.map do |locale|
|
||||
visible_locales.map do |locale|
|
||||
@translations[locale] = translation_for(locale)
|
||||
end
|
||||
@object.globalize_locales.map do |locale|
|
||||
visible_locales.map do |locale|
|
||||
Globalize.with_locale(locale) { fields_for_locale(locale, &block) }
|
||||
end.join.html_safe
|
||||
end
|
||||
@@ -26,6 +38,7 @@ module TranslatableFormHelper
|
||||
@template.content_tag :div, translations_options(translations_form.object, locale) do
|
||||
@template.concat translations_form.hidden_field(
|
||||
:_destroy,
|
||||
value: !@template.enabled_locale?(translations_form.object.globalized_model, locale),
|
||||
data: { locale: locale }
|
||||
)
|
||||
|
||||
@@ -52,15 +65,17 @@ module TranslatableFormHelper
|
||||
|
||||
def new_translation_for(locale)
|
||||
@object.translations.new(locale: locale).tap do |translation|
|
||||
unless locale == I18n.locale && no_other_translations?(translation)
|
||||
translation.mark_for_destruction
|
||||
end
|
||||
translation.mark_for_destruction
|
||||
end
|
||||
end
|
||||
|
||||
def highlight_translation_html_class
|
||||
@template.highlight_translation_html_class
|
||||
end
|
||||
|
||||
def translations_options(resource, locale)
|
||||
{
|
||||
class: "translatable-fields js-globalize-attribute",
|
||||
class: "translatable-fields js-globalize-attribute #{highlight_translation_html_class}",
|
||||
style: @template.display_translation_style(resource.globalized_model, locale),
|
||||
data: { locale: locale }
|
||||
}
|
||||
@@ -69,6 +84,14 @@ module TranslatableFormHelper
|
||||
def no_other_translations?(translation)
|
||||
(@object.translations - [translation]).reject(&:_destroy).empty?
|
||||
end
|
||||
|
||||
def visible_locales
|
||||
if @template.translations_interface_enabled?
|
||||
@object.globalize_locales
|
||||
else
|
||||
[I18n.locale]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TranslationsFieldsBuilder < FoundationRailsHelper::FormBuilder
|
||||
|
||||
@@ -22,8 +22,6 @@ class Budget < ApplicationRecord
|
||||
|
||||
CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze
|
||||
|
||||
before_validation :assign_model_to_translations
|
||||
|
||||
validates_translation :name, presence: true
|
||||
validates :phase, inclusion: { in: Budget::Phase::PHASE_KINDS }
|
||||
validates :currency_symbol, presence: true
|
||||
@@ -231,4 +229,16 @@ class Budget < ApplicationRecord
|
||||
slug.nil? || drafting?
|
||||
end
|
||||
|
||||
class Translation < Globalize::ActiveRecord::Translation
|
||||
validate :name_uniqueness_by_budget
|
||||
|
||||
def name_uniqueness_by_budget
|
||||
if Budget.joins(:translations)
|
||||
.where(name: name)
|
||||
.where.not("budget_translations.budget_id": budget_id).any?
|
||||
errors.add(:name, I18n.t("errors.messages.taken"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -22,8 +22,6 @@ class Budget
|
||||
|
||||
has_many :headings, dependent: :destroy
|
||||
|
||||
before_validation :assign_model_to_translations
|
||||
|
||||
validates_translation :name, presence: true
|
||||
validates :budget_id, presence: true
|
||||
validates :slug, presence: true, format: /\A[a-z0-9\-_]+\z/
|
||||
@@ -42,5 +40,18 @@ class Budget
|
||||
slug.nil? || budget.drafting?
|
||||
end
|
||||
|
||||
class Translation < Globalize::ActiveRecord::Translation
|
||||
delegate :budget, to: :globalized_model
|
||||
|
||||
validate :name_uniqueness_by_budget
|
||||
|
||||
def name_uniqueness_by_budget
|
||||
if budget.groups.joins(:translations)
|
||||
.where(name: name)
|
||||
.where.not("budget_group_translations.budget_group_id": budget_group_id).any?
|
||||
errors.add(:name, I18n.t("errors.messages.taken"))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,8 +26,6 @@ class Budget
|
||||
has_many :investments
|
||||
has_many :content_blocks
|
||||
|
||||
before_validation :assign_model_to_translations
|
||||
|
||||
validates_translation :name, presence: true
|
||||
validates :group_id, presence: true
|
||||
validates :price, presence: true
|
||||
@@ -62,5 +60,19 @@ class Budget
|
||||
slug.nil? || budget.drafting?
|
||||
end
|
||||
|
||||
class Translation < Globalize::ActiveRecord::Translation
|
||||
delegate :budget, to: :globalized_model
|
||||
|
||||
validate :name_uniqueness_by_budget
|
||||
|
||||
def name_uniqueness_by_budget
|
||||
if budget.headings
|
||||
.joins(:translations)
|
||||
.where(name: name)
|
||||
.where.not("budget_heading_translations.budget_heading_id": budget_heading_id).any?
|
||||
errors.add(:name, I18n.t("errors.messages.taken"))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Budget
|
||||
require "csv"
|
||||
class Investment < ApplicationRecord
|
||||
SORTING_OPTIONS = {id: "id", title: "title", supports: "cached_votes_up"}.freeze
|
||||
SORTING_OPTIONS = { id: "id", supports: "cached_votes_up" }.freeze
|
||||
|
||||
include ActiveModel::Dirty
|
||||
include Rails.application.routes.url_helpers
|
||||
@@ -28,6 +28,10 @@ class Budget
|
||||
|
||||
extend DownloadSettings::BudgetInvestmentCsv
|
||||
|
||||
translates :title, touch: true
|
||||
translates :description, touch: true
|
||||
include Globalizable
|
||||
|
||||
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
||||
belongs_to :heading
|
||||
belongs_to :group
|
||||
@@ -48,15 +52,13 @@ class Budget
|
||||
|
||||
delegate :name, :email, to: :author, prefix: true
|
||||
|
||||
validates :title, presence: true
|
||||
validates_translation :title, presence: true, length: { in: 4..Budget::Investment.title_max_length }
|
||||
validates_translation :description, presence: true, length: { maximum: Budget::Investment.description_max_length }
|
||||
|
||||
validates :author, presence: true
|
||||
validates :description, presence: true
|
||||
validates :heading_id, presence: true
|
||||
validates :unfeasibility_explanation, presence: { if: :unfeasibility_explanation_required? }
|
||||
validates :price, presence: { if: :price_required? }
|
||||
|
||||
validates :title, length: { in: 4..Budget::Investment.title_max_length }
|
||||
validates :description, length: { maximum: Budget::Investment.description_max_length }
|
||||
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
||||
|
||||
scope :sort_by_confidence_score, -> { reorder(confidence_score: :desc, id: :desc) }
|
||||
@@ -64,7 +66,6 @@ class Budget
|
||||
scope :sort_by_price, -> { reorder(price: :desc, confidence_score: :desc, id: :desc) }
|
||||
|
||||
scope :sort_by_id, -> { order("id DESC") }
|
||||
scope :sort_by_title, -> { order("title ASC") }
|
||||
scope :sort_by_supports, -> { order("cached_votes_up DESC") }
|
||||
|
||||
scope :valuation_open, -> { where(valuation_finished: false) }
|
||||
@@ -117,6 +118,10 @@ class Budget
|
||||
budget_investment_path(budget, self)
|
||||
end
|
||||
|
||||
def self.sort_by_title
|
||||
with_translation.sort_by(&:title)
|
||||
end
|
||||
|
||||
def self.filter_params(params)
|
||||
params.permit(%i[heading_id group_id administrator_id tag_name valuator_id])
|
||||
end
|
||||
@@ -162,10 +167,12 @@ class Budget
|
||||
def self.order_filter(params)
|
||||
sorting_key = params[:sort_by]&.downcase&.to_sym
|
||||
allowed_sort_option = SORTING_OPTIONS[sorting_key]
|
||||
direction = params[:direction] == "desc" ? "desc" : "asc"
|
||||
|
||||
if allowed_sort_option.present?
|
||||
direction = params[:direction] == "desc" ? "desc" : "asc"
|
||||
order("#{allowed_sort_option} #{direction}")
|
||||
elsif sorting_key == :title
|
||||
direction == "asc" ? sort_by_title : sort_by_title.reverse
|
||||
else
|
||||
order(cached_votes_up: :desc).order(id: :desc)
|
||||
end
|
||||
@@ -184,20 +191,17 @@ class Budget
|
||||
end
|
||||
|
||||
def self.search_by_title_or_id(title_or_id, results)
|
||||
if title_or_id =~ /^[0-9]+$/
|
||||
results.where(id: title_or_id)
|
||||
else
|
||||
results.where("title ILIKE ?", "%#{title_or_id}%")
|
||||
end
|
||||
return results.where(id: title_or_id) if title_or_id =~ /^[0-9]+$/
|
||||
|
||||
results.with_translations(Globalize.fallbacks(I18n.locale)).
|
||||
where("budget_investment_translations.title ILIKE ?", "%#{title_or_id}%")
|
||||
end
|
||||
|
||||
def searchable_values
|
||||
{ title => "A",
|
||||
author.username => "B",
|
||||
heading.try(:name) => "B",
|
||||
tag_list.join(" ") => "B",
|
||||
description => "C"
|
||||
}
|
||||
{ author.username => "B",
|
||||
heading.name => "B",
|
||||
tag_list.join(" ") => "B"
|
||||
}.merge(searchable_globalized_values)
|
||||
end
|
||||
|
||||
def self.search(terms)
|
||||
@@ -413,5 +417,10 @@ class Budget
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def searchable_translations_definitions
|
||||
{ title => "A",
|
||||
description => "D" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -100,5 +100,14 @@ class Budget
|
||||
PHASE_KINDS.index(kind) >= PHASE_KINDS.index(phase)
|
||||
end
|
||||
|
||||
class Translation < Globalize::ActiveRecord::Translation
|
||||
before_validation :sanitize_description
|
||||
|
||||
private
|
||||
|
||||
def sanitize_description
|
||||
self.description = WYSIWYGSanitizer.new.sanitize(description)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,7 +18,10 @@ class Comment < ApplicationRecord
|
||||
|
||||
attr_accessor :as_moderator, :as_administrator
|
||||
|
||||
validates :body, presence: true
|
||||
translates :body, touch: true
|
||||
include Globalizable
|
||||
|
||||
validates_translation :body, presence: true
|
||||
validates :user, presence: true
|
||||
|
||||
validates :commentable_type, inclusion: { in: COMMENTABLE_TYPES }
|
||||
|
||||
@@ -1,27 +1,101 @@
|
||||
module Globalizable
|
||||
MIN_TRANSLATIONS = 1
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
globalize_accessors
|
||||
accepts_nested_attributes_for :translations, allow_destroy: true
|
||||
|
||||
def locales_not_marked_for_destruction
|
||||
translations.reject(&:_destroy).map(&:locale)
|
||||
end
|
||||
|
||||
def assign_model_to_translations
|
||||
translations.each { |translation| translation.globalized_model = self }
|
||||
end
|
||||
validate :check_translations_number, on: :update, if: :translations_required?
|
||||
after_validation :copy_error_to_current_translation, on: :update
|
||||
|
||||
def description
|
||||
self.read_attribute(:description).try :html_safe
|
||||
end
|
||||
|
||||
def locales_not_marked_for_destruction
|
||||
translations.reject(&:marked_for_destruction?).map(&:locale)
|
||||
end
|
||||
|
||||
def locales_marked_for_destruction
|
||||
I18n.available_locales - locales_not_marked_for_destruction
|
||||
end
|
||||
|
||||
def locales_persisted_and_marked_for_destruction
|
||||
translations.select{|t| t.persisted? && t.marked_for_destruction? }.map(&:locale)
|
||||
end
|
||||
|
||||
def translations_required?
|
||||
translated_attribute_names.any?{|attr| required_attribute?(attr)}
|
||||
end
|
||||
|
||||
if self.paranoid? && translation_class.attribute_names.include?("hidden_at")
|
||||
translation_class.send :acts_as_paranoid, column: :hidden_at
|
||||
end
|
||||
|
||||
scope :with_translation, -> { joins("LEFT OUTER JOIN #{translations_table_name} ON #{table_name}.id = #{translations_table_name}.#{reflections["translations"].foreign_key} AND #{translations_table_name}.locale='#{I18n.locale }'") }
|
||||
|
||||
private
|
||||
|
||||
def required_attribute?(attribute)
|
||||
presence_validators = [ActiveModel::Validations::PresenceValidator,
|
||||
ActiveRecord::Validations::PresenceValidator]
|
||||
|
||||
attribute_validators(attribute).any?{|validator| presence_validators.include? validator }
|
||||
end
|
||||
|
||||
def attribute_validators(attribute)
|
||||
self.class.validators_on(attribute).map(&:class)
|
||||
end
|
||||
|
||||
def check_translations_number
|
||||
errors.add(:base, :translations_too_short) unless traslations_count_valid?
|
||||
end
|
||||
|
||||
def traslations_count_valid?
|
||||
translations.reject(&:marked_for_destruction?).count >= MIN_TRANSLATIONS
|
||||
end
|
||||
|
||||
def copy_error_to_current_translation
|
||||
return unless errors.added?(:base, :translations_too_short)
|
||||
|
||||
if locales_persisted_and_marked_for_destruction.include?(I18n.locale)
|
||||
locale = I18n.locale
|
||||
else
|
||||
locale = locales_persisted_and_marked_for_destruction.first
|
||||
end
|
||||
|
||||
translation = translation_for(locale)
|
||||
translation.errors.add(:base, :translations_too_short)
|
||||
end
|
||||
|
||||
def searchable_globalized_values
|
||||
values = {}
|
||||
translations.each do |translation|
|
||||
Globalize.with_locale(translation.locale) do
|
||||
values.merge! searchable_translations_definitions
|
||||
end
|
||||
end
|
||||
values
|
||||
end
|
||||
end
|
||||
|
||||
class_methods do
|
||||
def validates_translation(method, options = {})
|
||||
validates(method, options.merge(if: lambda { |resource| resource.translations.blank? }))
|
||||
translation_class.instance_eval { validates method, options }
|
||||
if options.include?(:length)
|
||||
lenght_validate = { length: options[:length] }
|
||||
translation_class.instance_eval do
|
||||
validates method, lenght_validate.merge(if: lambda { |translation| translation.locale == I18n.default_locale })
|
||||
end
|
||||
if options.count > 1
|
||||
translation_class.instance_eval do
|
||||
validates method, options.reject { |key| key == :length }
|
||||
end
|
||||
end
|
||||
else
|
||||
translation_class.instance_eval { validates method, options }
|
||||
end
|
||||
end
|
||||
|
||||
def translation_class_delegate(method)
|
||||
|
||||
@@ -12,6 +12,10 @@ module Notifiable
|
||||
end
|
||||
end
|
||||
|
||||
def notifiable_body
|
||||
body if attribute_names.include?("body")
|
||||
end
|
||||
|
||||
def notifiable_available?
|
||||
case self.class.name
|
||||
when "ProposalNotification"
|
||||
|
||||
@@ -20,6 +20,10 @@ class Debate < ApplicationRecord
|
||||
acts_as_paranoid column: :hidden_at
|
||||
include ActsAsParanoidAliases
|
||||
|
||||
translates :title, touch: true
|
||||
translates :description, touch: true
|
||||
include Globalizable
|
||||
|
||||
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
||||
belongs_to :geozone
|
||||
has_many :comments, as: :commentable
|
||||
@@ -27,13 +31,10 @@ class Debate < ApplicationRecord
|
||||
extend DownloadSettings::DebateCsv
|
||||
delegate :name, :email, to: :author, prefix: true
|
||||
|
||||
validates :title, presence: true
|
||||
validates :description, presence: true
|
||||
validates_translation :title, presence: true, length: { in: 4..Debate.title_max_length }
|
||||
validates_translation :description, presence: true, length: { in: 10..Debate.description_max_length }
|
||||
validates :author, presence: true
|
||||
|
||||
validates :title, length: { in: 4..Debate.title_max_length }
|
||||
validates :description, length: { in: 10..Debate.description_max_length }
|
||||
|
||||
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
||||
|
||||
before_save :calculate_hot_score, :calculate_confidence_score
|
||||
@@ -64,13 +65,17 @@ class Debate < ApplicationRecord
|
||||
.where("author_id != ?", user.id)
|
||||
end
|
||||
|
||||
def searchable_translations_definitions
|
||||
{ title => "A",
|
||||
description => "D" }
|
||||
end
|
||||
|
||||
def searchable_values
|
||||
{ title => "A",
|
||||
{
|
||||
author.username => "B",
|
||||
tag_list.join(" ") => "B",
|
||||
geozone.try(:name) => "B",
|
||||
description => "D"
|
||||
}
|
||||
}.merge!(searchable_globalized_values)
|
||||
end
|
||||
|
||||
def self.search(terms)
|
||||
|
||||
@@ -11,8 +11,6 @@ class Milestone < ApplicationRecord
|
||||
|
||||
validates :milestoneable, presence: true
|
||||
validates :publication_date, presence: true
|
||||
|
||||
before_validation :assign_model_to_translations
|
||||
validates_translation :description, presence: true, unless: -> { status_id.present? }
|
||||
|
||||
scope :order_by_publication_date, -> { order(publication_date: :asc, created_at: :asc) }
|
||||
|
||||
@@ -11,8 +11,9 @@ class Notification < ApplicationRecord
|
||||
scope :recent, -> { order(id: :desc) }
|
||||
scope :for_render, -> { includes(:notifiable) }
|
||||
|
||||
delegate :notifiable_title, :notifiable_available?, :check_availability,
|
||||
:linkable_resource, to: :notifiable, allow_nil: true
|
||||
delegate :notifiable_title, :notifiable_body, :notifiable_available?,
|
||||
:check_availability, :linkable_resource,
|
||||
to: :notifiable, allow_nil: true
|
||||
|
||||
def mark_as_read
|
||||
update(read_at: Time.current)
|
||||
|
||||
@@ -18,7 +18,6 @@ class ProgressBar < ApplicationRecord
|
||||
}
|
||||
validates :percentage, presence: true, inclusion: RANGE, numericality: { only_integer: true }
|
||||
|
||||
before_validation :assign_model_to_translations
|
||||
validates_translation :title, presence: true, unless: :primary?
|
||||
|
||||
end
|
||||
|
||||
@@ -28,6 +28,13 @@ class Proposal < ApplicationRecord
|
||||
|
||||
RETIRE_OPTIONS = %w[duplicated started unfeasible done other]
|
||||
|
||||
translates :title, touch: true
|
||||
translates :description, touch: true
|
||||
translates :summary, touch: true
|
||||
translates :retired_explanation, touch: true
|
||||
include Globalizable
|
||||
translation_class_delegate :retired_at
|
||||
|
||||
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
||||
belongs_to :geozone
|
||||
has_many :comments, as: :commentable, dependent: :destroy
|
||||
@@ -39,18 +46,16 @@ class Proposal < ApplicationRecord
|
||||
extend DownloadSettings::ProposalCsv
|
||||
delegate :name, :email, to: :author, prefix: true
|
||||
|
||||
extend DownloadSettings::ProposalCsv
|
||||
delegate :name, :email, to: :author, prefix: true
|
||||
validates_translation :title, presence: true, length: { in: 4..Proposal.title_max_length }
|
||||
validates_translation :description, length: { maximum: Proposal.description_max_length }
|
||||
validates_translation :summary, presence: true
|
||||
validates_translation :retired_explanation, presence: true, unless: -> { retired_at.blank? }
|
||||
|
||||
validates :title, presence: true
|
||||
validates :summary, presence: true
|
||||
validates :author, presence: true
|
||||
validates :responsible_name, presence: true, unless: :skip_user_verification?
|
||||
|
||||
validates :title, length: { in: 4..Proposal.title_max_length }
|
||||
validates :description, length: { maximum: Proposal.description_max_length }
|
||||
validates :responsible_name, length: { in: 6..Proposal.responsible_name_max_length }, unless: :skip_user_verification?
|
||||
validates :retired_reason, inclusion: { in: RETIRE_OPTIONS, allow_nil: true }
|
||||
validates :retired_reason, presence: true, inclusion: { in: RETIRE_OPTIONS }, unless: -> { retired_at.blank? }
|
||||
|
||||
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
||||
|
||||
@@ -120,14 +125,18 @@ class Proposal < ApplicationRecord
|
||||
"#{id}-#{title}".parameterize
|
||||
end
|
||||
|
||||
def searchable_translations_definitions
|
||||
{ title => "A",
|
||||
summary => "C",
|
||||
description => "D" }
|
||||
end
|
||||
|
||||
def searchable_values
|
||||
{ title => "A",
|
||||
author.username => "B",
|
||||
tag_list.join(" ") => "B",
|
||||
geozone.try(:name) => "B",
|
||||
summary => "C",
|
||||
description => "D"
|
||||
}
|
||||
{
|
||||
author.username => "B",
|
||||
tag_list.join(" ") => "B",
|
||||
geozone.try(:name) => "B"
|
||||
}.merge!(searchable_globalized_values)
|
||||
end
|
||||
|
||||
def self.search(terms)
|
||||
@@ -264,5 +273,4 @@ class Proposal < ApplicationRecord
|
||||
self.responsible_name = author.document_number
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
21
app/models/remote_translation.rb
Normal file
21
app/models/remote_translation.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class RemoteTranslation < ApplicationRecord
|
||||
|
||||
belongs_to :remote_translatable, polymorphic: true
|
||||
|
||||
validates :remote_translatable_id, presence: true
|
||||
validates :remote_translatable_type, presence: true
|
||||
validates :locale, presence: true
|
||||
|
||||
after_create :enqueue_remote_translation
|
||||
|
||||
def enqueue_remote_translation
|
||||
RemoteTranslations::Caller.new(self).delay.call
|
||||
end
|
||||
|
||||
def self.remote_translation_enqueued?(remote_translation)
|
||||
where(remote_translatable_id: remote_translation["remote_translatable_id"],
|
||||
remote_translatable_type: remote_translation["remote_translatable_type"],
|
||||
locale: remote_translation["locale"],
|
||||
error_message: nil).any?
|
||||
end
|
||||
end
|
||||
@@ -93,6 +93,8 @@ class Setting < ApplicationRecord
|
||||
"feature.allow_attached_documents": true,
|
||||
"feature.allow_images": true,
|
||||
"feature.help_page": true,
|
||||
"feature.remote_translations": nil,
|
||||
"feature.translation_interface": nil,
|
||||
"feature.valuation_comment_notification": true,
|
||||
"homepage.widgets.feeds.debates": true,
|
||||
"homepage.widgets.feeds.processes": true,
|
||||
|
||||
@@ -34,4 +34,4 @@ class Widget::Feed < ApplicationRecord
|
||||
Legislation::Process.open.published.order("created_at DESC").limit(limit)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,19 +1,33 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @admin_notification %>
|
||||
<%= render "shared/globalize_locales", resource: @admin_notification %>
|
||||
|
||||
<%= translatable_form_for [:admin, @admin_notification] do |f| %>
|
||||
<%= render "shared/errors", resource: @admin_notification %>
|
||||
|
||||
<%= f.select :segment_recipient, options_for_select(user_segments_options,
|
||||
@admin_notification[:segment_recipient]) %>
|
||||
<%= f.text_field :link %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= f.select :segment_recipient, options_for_select(user_segments_options,
|
||||
@admin_notification[:segment_recipient]) %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<%= f.text_field :link %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.text_field :title %>
|
||||
<%= translations_form.text_area :body %>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_field :title %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_area :body %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="margin-top">
|
||||
<%= f.submit t("admin.admin_notifications.#{admin_submit_action(@admin_notification)}.submit_button"),
|
||||
class: "button success" %>
|
||||
<div class="row">
|
||||
<div class="small-12 column margin-top">
|
||||
<%= f.submit t("admin.admin_notifications.#{admin_submit_action(@admin_notification)}.submit_button"),
|
||||
class: "button success" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @banner %>
|
||||
<%= render "shared/globalize_locales", resource: @banner %>
|
||||
|
||||
<%= translatable_form_for [:admin, @banner] do |f| %>
|
||||
|
||||
|
||||
@@ -1,24 +1,34 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @group %>
|
||||
<%= render "shared/globalize_locales", resource: @group %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= translatable_form_for [:admin, @budget, @group], url: path do |f| %>
|
||||
<%= translatable_form_for [:admin, @budget, @group], url: path do |f| %>
|
||||
|
||||
<%= render "shared/errors", resource: @group %>
|
||||
<%= render "shared/errors", resource: @group %>
|
||||
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.text_field :name,
|
||||
label: t("admin.budget_groups.form.name"),
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budget_groups.form.name") %>
|
||||
<div class="small-12 medium-6 column end">
|
||||
<%= translations_form.text_field :name,
|
||||
label: t("admin.budget_groups.form.name"),
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budget_groups.form.name") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @group.persisted? %>
|
||||
<% if @group.persisted? %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.select :max_votable_headings,
|
||||
(1..@group.headings.count),
|
||||
label: t("admin.budget_groups.max_votable_headings"),
|
||||
placeholder: t("admin.budget_groups.max_votable_headings") %>
|
||||
<% end %>
|
||||
|
||||
<%= f.submit t("admin.budget_groups.form.#{action}"), class: "button success" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.submit t("admin.budget_groups.form.#{action}"), class: "button success" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,52 +1,57 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @heading %>
|
||||
<%= render "shared/globalize_locales", resource: @heading %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= translatable_form_for [:admin, @budget, @group, @heading], url: path do |f| %>
|
||||
|
||||
<%= translatable_form_for [:admin, @budget, @group, @heading], url: path do |f| %>
|
||||
|
||||
<%= render "shared/errors", resource: @heading %>
|
||||
<%= render "shared/errors", resource: @heading %>
|
||||
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.text_field :name,
|
||||
label: t("admin.budget_headings.form.name"),
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budget_headings.form.name") %>
|
||||
<div class="small-12 medium-6 column end">
|
||||
<%= translations_form.text_field :name,
|
||||
label: t("admin.budget_headings.form.name"),
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budget_headings.form.name") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.text_field :price,
|
||||
label: t("admin.budget_headings.form.amount"),
|
||||
maxlength: 8,
|
||||
placeholder: t("admin.budget_headings.form.amount") %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :price,
|
||||
label: t("admin.budget_headings.form.amount"),
|
||||
maxlength: 8,
|
||||
placeholder: t("admin.budget_headings.form.amount") %>
|
||||
|
||||
<%= f.label :population, t("admin.budget_headings.form.population") %>
|
||||
<p class="help-text" id="budgets-population-help-text">
|
||||
<%= t("admin.budget_headings.form.population_info") %>
|
||||
</p>
|
||||
<%= f.text_field :population,
|
||||
label: false,
|
||||
maxlength: 8,
|
||||
placeholder: t("admin.budget_headings.form.population"),
|
||||
data: {toggle_focus: "population-info"},
|
||||
aria: {describedby: "budgets-population-help-text"} %>
|
||||
<%= f.label :population, t("admin.budget_headings.form.population") %>
|
||||
<p class="help-text" id="budgets-population-help-text">
|
||||
<%= t("admin.budget_headings.form.population_info") %>
|
||||
</p>
|
||||
<%= f.text_field :population,
|
||||
label: false,
|
||||
maxlength: 8,
|
||||
placeholder: t("admin.budget_headings.form.population"),
|
||||
data: {toggle_focus: "population-info"},
|
||||
aria: {describedby: "budgets-population-help-text"} %>
|
||||
|
||||
<%= f.text_field :latitude,
|
||||
label: t("admin.budget_headings.form.latitude"),
|
||||
maxlength: 22,
|
||||
placeholder: "latitude" %>
|
||||
<%= f.text_field :latitude,
|
||||
label: t("admin.budget_headings.form.latitude"),
|
||||
maxlength: 22,
|
||||
placeholder: "latitude" %>
|
||||
|
||||
<%= f.text_field :longitude,
|
||||
label: t("admin.budget_headings.form.longitude"),
|
||||
maxlength: 22,
|
||||
placeholder: "longitude" %>
|
||||
<p class="help-text" id="budgets-coordinates-help-text">
|
||||
<%= t("admin.budget_headings.form.coordinates_info") %>
|
||||
</p>
|
||||
<%= f.text_field :longitude,
|
||||
label: t("admin.budget_headings.form.longitude"),
|
||||
maxlength: 22,
|
||||
placeholder: "longitude" %>
|
||||
<p class="help-text" id="budgets-coordinates-help-text">
|
||||
<%= t("admin.budget_headings.form.coordinates_info") %>
|
||||
</p>
|
||||
|
||||
<%= f.check_box :allow_custom_content, label: t("admin.budget_headings.form.allow_content_block") %>
|
||||
<p class="help-text" id="budgets-content-blocks-help-text">
|
||||
<%= t("admin.budget_headings.form.content_blocks_info") %>
|
||||
</p>
|
||||
<%= f.check_box :allow_custom_content, label: t("admin.budget_headings.form.allow_content_block") %>
|
||||
<p class="help-text" id="budgets-content-blocks-help-text">
|
||||
<%= t("admin.budget_headings.form.content_blocks_info") %>
|
||||
</p>
|
||||
|
||||
<%= f.submit t("admin.budget_headings.form.#{action}"), class: "button success" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= f.submit t("admin.budget_headings.form.#{action}"), class: "button success" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -2,127 +2,134 @@
|
||||
<span class="icon-angle-left"></span> <%= t("shared.back") %>
|
||||
<% end %>
|
||||
|
||||
<%= form_for @investment,
|
||||
url: admin_budget_budget_investment_path(@budget, @investment) do |f| %>
|
||||
<%= render "shared/globalize_locales", resource: @investment %>
|
||||
|
||||
<% Budget::Investment.filter_params(params).to_h.each do |filter_name, filter_value| %>
|
||||
<%= hidden_field_tag filter_name, filter_value %>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<%= translatable_form_for @investment,
|
||||
url: admin_budget_budget_investment_path(@budget, @investment) do |f| %>
|
||||
|
||||
<div class="row expanded">
|
||||
<div class="small-12 column">
|
||||
<%= f.text_field :title,
|
||||
maxlength: Budget::Investment.title_max_length %>
|
||||
</div>
|
||||
<%= render "shared/errors", resource: @investment %>
|
||||
|
||||
<div class="ckeditor small-12 column">
|
||||
<%= f.cktext_area :description,
|
||||
maxlength: Budget::Investment.description_max_length,
|
||||
ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
<% Budget::Investment.filter_params(params).to_h.each do |filter_name, filter_value| %>
|
||||
<%= hidden_field_tag filter_name, filter_value %>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.label :tag_list, t("admin.budget_investments.edit.user_tags") %>
|
||||
<%= f.text_field :tag_list,
|
||||
value: @investment.tag_list.sort.join(","),
|
||||
label: false %>
|
||||
</div>
|
||||
<div class="row expanded">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_field :title,
|
||||
maxlength: Budget::Investment.title_max_length %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.text_field :external_url %>
|
||||
<div class="ckeditor small-12 column">
|
||||
<%= translations_form.cktext_area :description,
|
||||
maxlength: Budget::Investment.description_max_length,
|
||||
ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.label :tag_list, t("admin.budget_investments.edit.user_tags") %>
|
||||
<%= f.text_field :tag_list,
|
||||
value: @investment.tag_list.sort.join(","),
|
||||
label: false %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.select :heading_id, budget_heading_select_options(@budget), include_blank: t("admin.budget_investments.edit.select_heading") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.text_field :external_url %>
|
||||
</div>
|
||||
|
||||
<div class="row expanded margin-top">
|
||||
|
||||
<div class="small-12 column">
|
||||
<h2 id="classification"><%= t("admin.budget_investments.edit.classification") %></h2>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.select(:administrator_id,
|
||||
@admins.collect{ |a| [a.description_or_name_and_email, a.id ] },
|
||||
{ include_blank: t("admin.budget_investments.edit.undefined") }) %>
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.select :heading_id, budget_heading_select_options(@budget), include_blank: t("admin.budget_investments.edit.select_heading") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row expanded margin-top">
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.label :valuation_tag_list, t("admin.budget_investments.edit.tags") %>
|
||||
<div class="tags">
|
||||
<% @tags.each do |tag| %>
|
||||
<a class="js-add-tag-link"><%= tag.name %></a>
|
||||
<div class="small-12 column">
|
||||
<h2 id="classification"><%= t("admin.budget_investments.edit.classification") %></h2>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.select(:administrator_id,
|
||||
@admins.collect{ |a| [a.description_or_name_and_email, a.id ] },
|
||||
{ include_blank: t("admin.budget_investments.edit.undefined") }) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.label :valuation_tag_list, t("admin.budget_investments.edit.tags") %>
|
||||
<div class="tags">
|
||||
<% @tags.each do |tag| %>
|
||||
<a class="js-add-tag-link"><%= tag.name %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= f.text_field :valuation_tag_list,
|
||||
value: @investment.valuation_tag_list.sort.join(","),
|
||||
label: false,
|
||||
placeholder: t("admin.budget_investments.edit.tags_placeholder"),
|
||||
class: "js-tag-list" %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column margin-top">
|
||||
<%= f.label :valuator_ids, t("admin.budget_investments.edit.user_groups") %>
|
||||
<ul>
|
||||
<%= f.collection_check_boxes :valuator_group_ids, @valuator_groups, :id, :name do |group| %>
|
||||
<li><%= group.label(title: group.object.name) { group.check_box + truncate(group.object.name, length: 60) } %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
<%= f.label :valuator_ids, t("admin.budget_investments.edit.assigned_valuators") %>
|
||||
<ul>
|
||||
<%= f.collection_check_boxes :valuator_ids, @valuators, :id, :email do |b| %>
|
||||
<li><%= b.label(title: valuator_label(b.object)) { b.check_box + truncate(b.object.description_or_email, length: 60) } %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
<%= f.label :tracker_ids, t("admin.budget_investments.edit.assigned_trackers") %>
|
||||
<ul>
|
||||
<%= f.collection_check_boxes :tracker_ids, @trackers, :id, :email do |b| %>
|
||||
<li><%= b.label(title: tracker_label(b.object)) { b.check_box + truncate(b.object.description_or_email, length: 60) } %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row expanded margin-top">
|
||||
<% if @investment.incompatible? || @investment.winner? %>
|
||||
<div class="small-12 medium-3 column">
|
||||
<h2 id="incompatible"><%= t("admin.budget_investments.edit.compatibility") %></h2>
|
||||
<%= f.label :incompatible do %>
|
||||
<%= f.check_box :incompatible, title: t("admin.budget_investments.edit.compatibility"), label: false %>
|
||||
<span class="checkbox"><%= t("admin.budget_investments.edit.mark_as_incompatible") %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="small-12 medium-3 column float-left">
|
||||
<h2 id="selected"><%= t("admin.budget_investments.edit.selection") %></h2>
|
||||
<%= f.label :selected do %>
|
||||
<%= f.check_box :selected, title: t("admin.budget_investments.edit.selection"), label: false %>
|
||||
<span class="checkbox"><%= t("admin.budget_investments.edit.mark_as_selected") %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= f.text_field :valuation_tag_list,
|
||||
value: @investment.valuation_tag_list.sort.join(","),
|
||||
label: false,
|
||||
placeholder: t("admin.budget_investments.edit.tags_placeholder"),
|
||||
class: "js-tag-list" %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.text_field :milestone_tag_list,
|
||||
value: @investment.milestone_tag_list.sort.join(", "),
|
||||
label: t("admin.budget_investments.edit.milestone_tags") %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="small-12 column margin-top">
|
||||
<%= f.label :valuator_ids, t("admin.budget_investments.edit.user_groups") %>
|
||||
<ul>
|
||||
<%= f.collection_check_boxes :valuator_group_ids, @valuator_groups, :id, :name do |group| %>
|
||||
<li><%= group.label(title: group.object.name) { group.check_box + truncate(group.object.name, length: 60) } %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= f.submit(class: "button", value: t("admin.budget_investments.edit.submit_button")) %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
<%= f.label :valuator_ids, t("admin.budget_investments.edit.assigned_valuators") %>
|
||||
<ul>
|
||||
<%= f.collection_check_boxes :valuator_ids, @valuators, :id, :email do |b| %>
|
||||
<li><%= b.label(title: valuator_label(b.object)) { b.check_box + truncate(b.object.description_or_email, length: 60) } %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
<%= f.label :tracker_ids, t("admin.budget_investments.edit.assigned_trackers") %>
|
||||
<ul>
|
||||
<%= f.collection_check_boxes :tracker_ids, @trackers, :id, :email do |b| %>
|
||||
<li><%= b.label(title: tracker_label(b.object)) { b.check_box + truncate(b.object.description_or_email, length: 60) } %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row expanded margin-top">
|
||||
<% if @investment.incompatible? || @investment.winner? %>
|
||||
<div class="small-12 medium-3 column">
|
||||
<h2 id="incompatible"><%= t("admin.budget_investments.edit.compatibility") %></h2>
|
||||
<%= f.label :incompatible do %>
|
||||
<%= f.check_box :incompatible, title: t("admin.budget_investments.edit.compatibility"), label: false %>
|
||||
<span class="checkbox"><%= t("admin.budget_investments.edit.mark_as_incompatible") %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="small-12 medium-3 column float-left">
|
||||
<h2 id="selected"><%= t("admin.budget_investments.edit.selection") %></h2>
|
||||
<%= f.label :selected do %>
|
||||
<%= f.check_box :selected, title: t("admin.budget_investments.edit.selection"), label: false %>
|
||||
<span class="checkbox"><%= t("admin.budget_investments.edit.mark_as_selected") %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.text_field :milestone_tag_list,
|
||||
value: @investment.milestone_tag_list.sort.join(", "),
|
||||
label: t("admin.budget_investments.edit.milestone_tags") %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="small-12 column margin-top">
|
||||
<%= f.submit(class: "button", value: t("admin.budget_investments.edit.submit_button")) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,65 +1,74 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @phase %>
|
||||
<%= render "shared/globalize_locales", resource: @phase %>
|
||||
|
||||
<%= translatable_form_for [:admin, @phase.budget, @phase] do |f| %>
|
||||
|
||||
<%= render "shared/errors", resource: @phase %>
|
||||
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.label :starts_at, t("admin.budget_phases.edit.start_date") %>
|
||||
<%= f.text_field :starts_at,
|
||||
value: format_date_for_calendar_form(@phase.starts_at),
|
||||
class: "js-calendar-full",
|
||||
id: "start_date",
|
||||
label: false %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.label :ends_at, t("admin.budget_phases.edit.end_date") %>
|
||||
<%= f.text_field :ends_at,
|
||||
value: format_date_for_calendar_form(@phase.ends_at),
|
||||
class: "js-calendar-full",
|
||||
id: "end_date",
|
||||
label: false %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.label :starts_at, t("admin.budget_phases.edit.start_date") %>
|
||||
<%= f.text_field :starts_at,
|
||||
value: format_date_for_calendar_form(@phase.starts_at),
|
||||
class: "js-calendar-full",
|
||||
id: "start_date",
|
||||
label: false %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.label :ends_at, t("admin.budget_phases.edit.end_date") %>
|
||||
<%= f.text_field :ends_at,
|
||||
value: format_date_for_calendar_form(@phase.ends_at),
|
||||
class: "js-calendar-full",
|
||||
id: "end_date",
|
||||
label: false %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 column">
|
||||
<%= f.label :description, t("admin.budget_phases.edit.description") %>
|
||||
|
||||
<%= f.label :description, t("admin.budget_phases.edit.description") %>
|
||||
<span class="help-text" id="phase-description-help-text">
|
||||
<%= t("admin.budget_phases.edit.description_help_text") %>
|
||||
</span>
|
||||
|
||||
<span class="help-text" id="phase-description-help-text">
|
||||
<%= t("admin.budget_phases.edit.description_help_text") %>
|
||||
</span>
|
||||
|
||||
<div class="ckeditor">
|
||||
<%= translations_form.cktext_area :description,
|
||||
maxlength: Budget::Phase::DESCRIPTION_MAX_LENGTH,
|
||||
label: false %>
|
||||
<div class="ckeditor">
|
||||
<%= translations_form.cktext_area :description,
|
||||
maxlength: Budget::Phase::DESCRIPTION_MAX_LENGTH,
|
||||
label: false %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.label :summary, t("admin.budget_phases.edit.summary") %>
|
||||
<div class="small-12 column">
|
||||
<%= f.label :summary, t("admin.budget_phases.edit.summary") %>
|
||||
|
||||
<span class="help-text" id="phase-summary-help-text">
|
||||
<%= t("admin.budget_phases.edit.summary_help_text") %>
|
||||
</span>
|
||||
<span class="help-text" id="phase-summary-help-text">
|
||||
<%= t("admin.budget_phases.edit.summary_help_text") %>
|
||||
</span>
|
||||
|
||||
<div class="ckeditor">
|
||||
<%= translations_form.cktext_area :summary,
|
||||
maxlength: Budget::Phase::SUMMARY_MAX_LENGTH,
|
||||
label: false%>
|
||||
<div class="ckeditor">
|
||||
<%= translations_form.cktext_area :summary,
|
||||
maxlength: Budget::Phase::SUMMARY_MAX_LENGTH,
|
||||
label: false %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column margin-top">
|
||||
<%= f.check_box :enabled, label: t("admin.budget_phases.edit.enabled") %>
|
||||
<div class="row">
|
||||
<div class="small-12 column margin-top">
|
||||
<%= f.check_box :enabled, label: t("admin.budget_phases.edit.enabled") %>
|
||||
|
||||
<span class="help-text" id="phase-summary-help-text">
|
||||
<%= t("admin.budget_phases.edit.enabled_help_text") %>
|
||||
</span>
|
||||
<span class="help-text" id="phase-summary-help-text">
|
||||
<%= t("admin.budget_phases.edit.enabled_help_text") %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 large-3 column end margin-top">
|
||||
<%= f.submit t("admin.budget_phases.edit.save_changes"), class: "button success expanded" %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-4 large-3 column end margin-top">
|
||||
<%= f.submit t("admin.budget_phases.edit.save_changes"), class: "button success expanded" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<%= back_link_to edit_admin_budget_path(@phase.budget) %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<h2><%= t("admin.budgets.edit.title") %> - <%= t("budgets.phase.#{@phase.kind}") %></h2>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<h2><%= t("admin.budgets.edit.title") %> - <%= t("budgets.phase.#{@phase.kind}") %></h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "/admin/budget_phases/form" %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @budget %>
|
||||
<%= render "shared/globalize_locales", resource: @budget %>
|
||||
|
||||
<%= translatable_form_for [:admin, @budget] do |f| %>
|
||||
|
||||
@@ -6,16 +6,18 @@
|
||||
|
||||
<%= render "shared/errors", resource: @budget %>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.text_field :name,
|
||||
label: t("activerecord.attributes.budget.name"),
|
||||
maxlength: Budget.title_max_length,
|
||||
placeholder: t("activerecord.attributes.budget.name") %>
|
||||
<div class="small-12 medium-9 column end">
|
||||
<%= translations_form.text_field :name,
|
||||
label: t("activerecord.attributes.budget.name"),
|
||||
maxlength: Budget.title_max_length,
|
||||
placeholder: t("activerecord.attributes.budget.name") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="margin-top">
|
||||
<div class="row margin-top">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.select :phase, budget_phases_select_options %>
|
||||
</div>
|
||||
@@ -58,76 +60,80 @@
|
||||
</div>
|
||||
|
||||
<% if @budget.phases.present? %>
|
||||
<div class="small-12 column">
|
||||
<table id="budget-phases-table" class="table-for-mobile">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.budgets.edit.phase") %></th>
|
||||
<th><%= t("admin.budgets.edit.dates") %></th>
|
||||
<th class="text-center"><%= t("admin.budgets.edit.enabled") %></th>
|
||||
<th><%= t("admin.budgets.edit.actions") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<table id="budget-phases-table" class="table-for-mobile">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.budgets.edit.phase") %></th>
|
||||
<th><%= t("admin.budgets.edit.dates") %></th>
|
||||
<th class="text-center"><%= t("admin.budgets.edit.enabled") %></th>
|
||||
<th><%= t("admin.budgets.edit.actions") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<% @budget.phases.order(:id).each do |phase| %>
|
||||
<tr id="<%= dom_id(phase) %>" class="phase">
|
||||
<td>
|
||||
<%= t("budgets.phase.#{phase.kind}") %>
|
||||
<% if @budget.current_phase == phase %>
|
||||
<span class="label success"><strong><%= t("admin.budgets.edit.active") %></strong></span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if phase.starts_at.present? || phase.ends_at.present? %>
|
||||
<%= l(phase.starts_at.to_date) if phase.starts_at.present? %>
|
||||
-
|
||||
<%= l(phase.ends_at.to_date) if phase.ends_at.present? %>
|
||||
<% else %>
|
||||
<em><%= t("admin.budgets.edit.blank_dates") %></em>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="budget-phase-enabled <%= phase.enabled? ? "enabled" : "disabled" %>"></span>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("admin.budgets.edit.edit_phase"),
|
||||
edit_admin_budget_budget_phase_path(@budget, phase),
|
||||
method: :get, class: "button hollow expanded" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% @budget.phases.order(:id).each do |phase| %>
|
||||
<tr id="<%= dom_id(phase) %>" class="phase">
|
||||
<td>
|
||||
<%= t("budgets.phase.#{phase.kind}") %>
|
||||
<% if @budget.current_phase == phase %>
|
||||
<span class="label success"><strong><%= t("admin.budgets.edit.active") %></strong></span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if phase.starts_at.present? || phase.ends_at.present? %>
|
||||
<%= l(phase.starts_at.to_date) if phase.starts_at.present? %>
|
||||
-
|
||||
<%= l(phase.ends_at.to_date) if phase.ends_at.present? %>
|
||||
<% else %>
|
||||
<em><%= t("admin.budgets.edit.blank_dates") %></em>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="budget-phase-enabled <%= phase.enabled? ? "enabled" : "disabled" %>"></span>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("admin.budgets.edit.edit_phase"),
|
||||
edit_admin_budget_budget_phase_path(@budget, phase),
|
||||
method: :get, class: "button hollow expanded" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= render "admin/shared/show_results_fields", form: f %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<div class="clear small-12 medium-4 large-3 inline-block">
|
||||
<%= f.submit nil, class: "button success" %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= render "admin/shared/show_results_fields", form: f %>
|
||||
</div>
|
||||
|
||||
<div class="float-right">
|
||||
<% if display_calculate_winners_button?(@budget) %>
|
||||
<%= link_to calculate_winner_button_text(@budget),
|
||||
calculate_winners_admin_budget_path(@budget),
|
||||
method: :put,
|
||||
class: "button hollow" %>
|
||||
<% end %>
|
||||
<div class="small-12 column">
|
||||
<div class="clear small-12 medium-4 large-3 inline-block">
|
||||
<%= f.submit nil, class: "button success" %>
|
||||
</div>
|
||||
|
||||
<% if @budget.has_winning_investments? %>
|
||||
<%= link_to t("budgets.show.see_results"),
|
||||
budget_results_path(@budget),
|
||||
class: "button hollow margin-left" %>
|
||||
<% end %>
|
||||
<% if @budget.persisted? %>
|
||||
<%= link_to t("admin.budgets.edit.delete"),
|
||||
admin_budget_path(@budget),
|
||||
method: :delete,
|
||||
class: "delete float-right margin-left" %>
|
||||
<% end %>
|
||||
<div class="float-right">
|
||||
<% if display_calculate_winners_button?(@budget) %>
|
||||
<%= link_to calculate_winner_button_text(@budget),
|
||||
calculate_winners_admin_budget_path(@budget),
|
||||
method: :put,
|
||||
class: "button hollow" %>
|
||||
<% end %>
|
||||
|
||||
<% if @budget.has_winning_investments? %>
|
||||
<%= link_to t("budgets.show.see_results"),
|
||||
budget_results_path(@budget),
|
||||
class: "button hollow margin-left" %>
|
||||
<% end %>
|
||||
<% if @budget.persisted? %>
|
||||
<%= link_to t("admin.budgets.edit.delete"),
|
||||
admin_budget_path(@budget),
|
||||
method: :delete,
|
||||
class: "delete float-right margin-left" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<%= back_link_to admin_budgets_path %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<h2><%= t("admin.budgets.edit.title") %></h2>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<h2><%= t("admin.budgets.edit.title") %></h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "/admin/budgets/form" %>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<div class="small-12 column">
|
||||
<h2><%= t("admin.budgets.new.title") %></h2>
|
||||
</div>
|
||||
<h2><%= t("admin.budgets.new.title") %></h2>
|
||||
|
||||
<%= render "/admin/budgets/form" %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @draft_version %>
|
||||
<%= render "shared/globalize_locales", resource: @draft_version %>
|
||||
|
||||
<%= translatable_form_for [:admin, @process, @draft_version], url: url, html: {data: {watch_changes: true}} do |f| %>
|
||||
|
||||
@@ -15,73 +15,77 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_field :title,
|
||||
placeholder: t("admin.legislation.draft_versions.form.title_placeholder") %>
|
||||
</div>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_field :title,
|
||||
placeholder: t("admin.legislation.draft_versions.form.title_placeholder") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_area :changelog,
|
||||
hint: t("admin.legislation.draft_versions.form.use_markdown"),
|
||||
rows: 5,
|
||||
placeholder: t("admin.legislation.draft_versions.form.changelog_placeholder") %>
|
||||
</div>
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_area :changelog,
|
||||
hint: t("admin.legislation.draft_versions.form.use_markdown"),
|
||||
rows: 5,
|
||||
placeholder: t("admin.legislation.draft_versions.form.changelog_placeholder") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<%= translations_form.label :body, nil, hint: t("admin.legislation.draft_versions.form.use_markdown") %>
|
||||
</div>
|
||||
<div class="small-12 medium-4 column">
|
||||
<%= translations_form.label :body, nil, hint: t("admin.legislation.draft_versions.form.use_markdown") %>
|
||||
</div>
|
||||
|
||||
<div class="markdown-editor clear">
|
||||
<div class="small-12 medium-8 column fullscreen-container">
|
||||
<div class="markdown-editor-header truncate">
|
||||
<%= t("admin.legislation.draft_versions.form.title_html",
|
||||
draft_version_title: @draft_version.title,
|
||||
process_title: @process.title ) %>
|
||||
<div class="markdown-editor clear">
|
||||
<div class="small-12 medium-8 column fullscreen-container">
|
||||
<div class="markdown-editor-header truncate">
|
||||
<%= t("admin.legislation.draft_versions.form.title_html",
|
||||
draft_version_title: @draft_version.title,
|
||||
process_title: @process.title ) %>
|
||||
</div>
|
||||
|
||||
<div class="markdown-editor-buttons">
|
||||
<%= f.submit(class: "button", value: t("admin.legislation.draft_versions.#{admin_submit_action(@draft_version)}.submit_button")) %>
|
||||
</div>
|
||||
|
||||
<%= link_to "#", class: "fullscreen-toggle" do %>
|
||||
<span data-closed-text="<%= t("admin.legislation.draft_versions.form.launch_text_editor") %>"
|
||||
data-open-text="<%= t("admin.legislation.draft_versions.form.close_text_editor") %>">
|
||||
<strong><%= t("admin.legislation.draft_versions.form.launch_text_editor") %></strong>
|
||||
</span>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="markdown-editor-buttons">
|
||||
<%= f.submit(class: "button", value: t("admin.legislation.draft_versions.#{admin_submit_action(@draft_version)}.submit_button")) %>
|
||||
<div class="small-12 medium-6 column markdown-area">
|
||||
<%= translations_form.text_area :body,
|
||||
label: false,
|
||||
rows: 10,
|
||||
placeholder: t("admin.legislation.draft_versions.form.body_placeholder") %>
|
||||
</div>
|
||||
|
||||
<%= link_to "#", class: "fullscreen-toggle" do %>
|
||||
<span data-closed-text="<%= t("admin.legislation.draft_versions.form.launch_text_editor")%>"
|
||||
data-open-text="<%= t("admin.legislation.draft_versions.form.close_text_editor")%>">
|
||||
<strong><%= t("admin.legislation.draft_versions.form.launch_text_editor")%></strong>
|
||||
</span>
|
||||
|
||||
<% end %>
|
||||
<div class="small-12 medium-6 column markdown-preview">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 column markdown-area">
|
||||
<%= translations_form.text_area :body,
|
||||
label: false,
|
||||
rows: 10,
|
||||
placeholder: t("admin.legislation.draft_versions.form.body_placeholder") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 column markdown-preview">
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= f.label :status %>
|
||||
<% ::Legislation::DraftVersion::VALID_STATUSES.each do |status| %>
|
||||
<%= f.radio_button :status, status, label: false %>
|
||||
<%= f.label "status_#{status}", t("admin.legislation.draft_versions.statuses.#{status}") %>
|
||||
<span class="help-text"><%= t("admin.legislation.draft_versions.form.hints.status.#{status}") %></span>
|
||||
<br>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= f.label :final_version %>
|
||||
<%= f.check_box :final_version, label: false %>
|
||||
<span class="help-text"><%= t("admin.legislation.draft_versions.form.hints.final_version") %></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= f.label :status %>
|
||||
<% ::Legislation::DraftVersion::VALID_STATUSES.each do |status| %>
|
||||
<%= f.radio_button :status, status, label: false %>
|
||||
<%= f.label "status_#{status}", t("admin.legislation.draft_versions.statuses.#{status}") %>
|
||||
<span class="help-text"><%= t("admin.legislation.draft_versions.form.hints.status.#{status}") %></span>
|
||||
<br>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column clear end margin-top">
|
||||
<%= f.submit(class: "button success expanded", value: t("admin.legislation.draft_versions.#{admin_submit_action(@draft_version)}.submit_button")) %>
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= f.label :final_version %>
|
||||
<%= f.check_box :final_version, label: false %>
|
||||
<span class="help-text"><%= t("admin.legislation.draft_versions.form.hints.final_version") %></span>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column clear end margin-top">
|
||||
<%= f.submit(class: "button success expanded", value: t("admin.legislation.draft_versions.#{admin_submit_action(@draft_version)}.submit_button")) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
|
||||
<%= render "admin/legislation/processes/subnav", process: @process, active: "draft_versions" %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<h3><%= t("admin.legislation.draft_versions.new.title") %></h3>
|
||||
</div>
|
||||
<h3><%= t("admin.legislation.draft_versions.new.title") %></h3>
|
||||
|
||||
<%= render "form", url: admin_legislation_process_draft_versions_path(@process) %>
|
||||
</div>
|
||||
|
||||
@@ -1,28 +1,34 @@
|
||||
<%= render "admin/shared/globalize_tabs",
|
||||
<%= render "shared/globalize_locales",
|
||||
resource: @process,
|
||||
display_style: lambda { |locale| enable_translation_style(@process, locale) } %>
|
||||
display_style: lambda { |locale| enable_translation_style(@process, locale) },
|
||||
manage_languages: false %>
|
||||
|
||||
<%= translatable_form_for [:admin, @process], url: url, html: {data: {watch_changes: true}} do |f| %>
|
||||
|
||||
<%= render "shared/errors", resource: @process %>
|
||||
|
||||
<div class="small-12 column margin-top">
|
||||
<%= f.check_box :homepage_enabled, label: t("admin.legislation.processes.form.homepage_enabled") %>
|
||||
<div class="row">
|
||||
<div class="small-12 column margin-top">
|
||||
<%= f.check_box :homepage_enabled, label: t("admin.legislation.processes.form.homepage_enabled") %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 column">
|
||||
<div class="ckeditor">
|
||||
<%= translations_form.cktext_area :homepage,
|
||||
language: I18n.locale,
|
||||
label: t("admin.legislation.processes.form.homepage"),
|
||||
ckeditor: { height: 500, toolbar: "admin" },
|
||||
hint: t("admin.legislation.processes.form.homepage_description") %>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 column">
|
||||
<div class="ckeditor">
|
||||
<%= translations_form.cktext_area :homepage,
|
||||
language: I18n.locale,
|
||||
label: t("admin.legislation.processes.form.homepage"),
|
||||
ckeditor: { height: 500, toolbar: "admin" },
|
||||
hint: t("admin.legislation.processes.form.homepage_description") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column end margin-top">
|
||||
<%= f.submit(class: "button success expanded", value: t("admin.legislation.processes.#{admin_submit_action(@process)}.submit_button")) %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-3 column end margin-top">
|
||||
<%= f.submit(class: "button success expanded", value: t("admin.legislation.processes.#{admin_submit_action(@process)}.submit_button")) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
<%= render "admin/shared/globalize_tabs",
|
||||
<%= render "shared/globalize_locales",
|
||||
resource: @process,
|
||||
display_style: lambda { |locale| enable_translation_style(@process, locale) } %>
|
||||
display_style: lambda { |locale| enable_translation_style(@process, locale) },
|
||||
manage_languages: false %>
|
||||
|
||||
<%= translatable_form_for [:admin, @process] do |f| %>
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="ckeditor">
|
||||
<%= translations_form.cktext_area :milestones_summary, ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="ckeditor column">
|
||||
<%= translations_form.cktext_area :milestones_summary, ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.submit class: "button success" %>
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<%= f.submit class: "button success" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,256 +1,261 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @process %>
|
||||
<%= render "shared/globalize_locales", resource: @process %>
|
||||
|
||||
<%= translatable_form_for [:admin, @process], html: {data: {watch_changes: true}} do |f| %>
|
||||
|
||||
<% if @process.errors.any? %>
|
||||
|
||||
<div id="error_explanation" data-alert class="callout alert" data-closable>
|
||||
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div id="error_explanation" data-alert class="callout alert" data-closable>
|
||||
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
||||
<strong>
|
||||
<%= @process.errors.count %>
|
||||
<%= t("admin.legislation.processes.errors.form.error", count: @process.errors.count) %>
|
||||
</strong>
|
||||
</div>
|
||||
<strong>
|
||||
<%= @process.errors.count %>
|
||||
<%= t("admin.legislation.processes.errors.form.error", count: @process.errors.count) %>
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.draft_phase") %></label>
|
||||
<p class="help-text"><%= t("admin.legislation.processes.form.draft_phase_description") %></p>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.draft_phase") %></label>
|
||||
<p class="help-text"><%= t("admin.legislation.processes.form.draft_phase_description") %></p>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :draft_start_date,
|
||||
value: format_date_for_calendar_form(@process.draft_start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "draft_start_date" %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :draft_start_date,
|
||||
value: format_date_for_calendar_form(@process.draft_start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "draft_start_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :draft_end_date,
|
||||
value: format_date_for_calendar_form(@process.draft_end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "draft_end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :draft_phase_enabled, checked: @process.draft_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :draft_end_date,
|
||||
value: format_date_for_calendar_form(@process.draft_end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "draft_end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :draft_phase_enabled, checked: @process.draft_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.process") %></label>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.process") %></label>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :start_date,
|
||||
value: format_date_for_calendar_form(@process.start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "start_date" %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :start_date,
|
||||
value: format_date_for_calendar_form(@process.start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "start_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :end_date,
|
||||
value: format_date_for_calendar_form(@process.end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :published, checked: @process.published?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :end_date,
|
||||
value: format_date_for_calendar_form(@process.end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :published, checked: @process.published?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.debate_phase") %></label>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.debate_phase") %></label>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :debate_start_date,
|
||||
value: format_date_for_calendar_form(@process.debate_start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "debate_start_date" %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :debate_start_date,
|
||||
value: format_date_for_calendar_form(@process.debate_start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "debate_start_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :debate_end_date,
|
||||
value: format_date_for_calendar_form(@process.debate_end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "debate_end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :debate_phase_enabled, checked: @process.debate_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :debate_end_date,
|
||||
value: format_date_for_calendar_form(@process.debate_end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "debate_end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :debate_phase_enabled, checked: @process.debate_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.proposals_phase") %></label>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.proposals_phase") %></label>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :proposals_phase_start_date,
|
||||
value: format_date_for_calendar_form(@process.proposals_phase_start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "proposals_phase_start_date" %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :proposals_phase_start_date,
|
||||
value: format_date_for_calendar_form(@process.proposals_phase_start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "proposals_phase_start_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :proposals_phase_end_date,
|
||||
value: format_date_for_calendar_form(@process.proposals_phase_end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "proposals_phase_end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :proposals_phase_enabled, checked: @process.proposals_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :proposals_phase_end_date,
|
||||
value: format_date_for_calendar_form(@process.proposals_phase_end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "proposals_phase_end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :proposals_phase_enabled, checked: @process.proposals_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.allegations_phase") %></label>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.legislation.processes.form.allegations_phase") %></label>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :allegations_start_date,
|
||||
value: format_date_for_calendar_form(@process.allegations_start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "allegations_start_date" %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :allegations_start_date,
|
||||
value: format_date_for_calendar_form(@process.allegations_start_date),
|
||||
class: "js-calendar-full",
|
||||
id: "allegations_start_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :allegations_end_date,
|
||||
value: format_date_for_calendar_form(@process.allegations_end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "allegations_end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :allegations_phase_enabled, checked: @process.allegations_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= f.text_field :allegations_end_date,
|
||||
value: format_date_for_calendar_form(@process.allegations_end_date),
|
||||
class: "js-calendar-full",
|
||||
id: "allegations_end_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :allegations_phase_enabled, checked: @process.allegations_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column end">
|
||||
<%= f.text_field :draft_publication_date,
|
||||
value: format_date_for_calendar_form(@process.draft_publication_date),
|
||||
class: "js-calendar-full",
|
||||
id: "draft_publication_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :draft_publication_enabled, checked: @process.draft_publication.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column end">
|
||||
<%= f.text_field :draft_publication_date,
|
||||
value: format_date_for_calendar_form(@process.draft_publication_date),
|
||||
class: "js-calendar-full",
|
||||
id: "draft_publication_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :draft_publication_enabled, checked: @process.draft_publication.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="small-12 medium-3 column end">
|
||||
<%= f.text_field :result_publication_date,
|
||||
value: format_date_for_calendar_form(@process.result_publication_date),
|
||||
class: "js-calendar-full",
|
||||
id: "result_publication_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :result_publication_enabled, checked: @process.result_publication.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column end">
|
||||
<%= f.text_field :result_publication_date,
|
||||
value: format_date_for_calendar_form(@process.result_publication_date),
|
||||
class: "js-calendar-full",
|
||||
id: "result_publication_date" %>
|
||||
</div>
|
||||
<div class="small-12 medium-2 column margin-top">
|
||||
<%= f.check_box :result_publication_enabled, checked: @process.result_publication.enabled?, label: t("admin.legislation.processes.form.enabled") %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="documents small-12 column">
|
||||
<%= render "documents/nested_documents", documentable: @process, f: f %>
|
||||
</div>
|
||||
|
||||
<div class="documents small-12 column">
|
||||
<%= render "documents/nested_documents", documentable: @process, f: f %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="images small-12 column">
|
||||
<%= render "images/nested_image", imageable: @process, f: f %>
|
||||
</div>
|
||||
|
||||
<div class="images small-12 column">
|
||||
<%= render "images/nested_image", imageable: @process, f: f %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<h3><%= t("admin.legislation.processes.form.banner_title") %></h3>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<h3><%= t("admin.legislation.processes.form.banner_title") %></h3>
|
||||
</div>
|
||||
|
||||
<div class="small-6 large-3 column">
|
||||
<%= f.label :background_color, nil, for: "background_color_input" %>
|
||||
<p class="help-text"><%= t("admin.shared.color_help") %></p>
|
||||
<div class="row collapse">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :background_color, label: false, type: :color,
|
||||
value: bg_color_or_default %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :background_color, label: false, id: "background_color_input" %>
|
||||
<div class="small-6 large-3 column">
|
||||
<%= f.label :background_color, nil, for: "background_color_input" %>
|
||||
<p class="help-text"><%= t("admin.shared.color_help") %></p>
|
||||
<div class="row collapse">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :background_color, label: false, type: :color,
|
||||
value: bg_color_or_default %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :background_color, label: false, id: "background_color_input" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-6 large-3 column end">
|
||||
<%= f.label :font_color, nil, for: "font_color_input" %>
|
||||
<p class="help-text"><%= t("admin.shared.color_help") %></p>
|
||||
<div class="row collapse">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :font_color, label: false, type: :color, value: font_color_or_default %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :font_color, label: false, id: "font_color_input" %>
|
||||
<div class="small-6 large-3 column end">
|
||||
<%= f.label :font_color, nil, for: "font_color_input" %>
|
||||
<p class="help-text"><%= t("admin.shared.color_help") %></p>
|
||||
<div class="row collapse">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :font_color, label: false, type: :color, value: font_color_or_default %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :font_color, label: false, id: "font_color_input" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_field :title,
|
||||
placeholder: t("admin.legislation.processes.form.title_placeholder") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_area :summary,
|
||||
rows: 2,
|
||||
placeholder: t("admin.legislation.processes.form.summary_placeholder"),
|
||||
hint: t("admin.legislation.processes.form.use_markdown") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_area :description,
|
||||
rows: 5,
|
||||
placeholder: t("admin.legislation.processes.form.description_placeholder"),
|
||||
hint: t("admin.legislation.processes.form.use_markdown") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-9 column end">
|
||||
<%= translations_form.text_area :additional_info,
|
||||
rows: 10,
|
||||
placeholder: t("admin.legislation.processes.form.additional_info_placeholder"),
|
||||
hint: t("admin.legislation.processes.form.use_markdown") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_field :title,
|
||||
placeholder: t("admin.legislation.processes.form.title_placeholder") %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-3 column clear end">
|
||||
<%= f.submit(class: "button success expanded", value: t("admin.legislation.processes.#{admin_submit_action(@process)}.submit_button")) %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_area :summary,
|
||||
rows: 2,
|
||||
placeholder: t("admin.legislation.processes.form.summary_placeholder"),
|
||||
hint: t("admin.legislation.processes.form.use_markdown") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= translations_form.text_area :description,
|
||||
rows: 5,
|
||||
placeholder: t("admin.legislation.processes.form.description_placeholder"),
|
||||
hint: t("admin.legislation.processes.form.use_markdown") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-9 column end">
|
||||
<%= translations_form.text_area :additional_info,
|
||||
rows: 10,
|
||||
placeholder: t("admin.legislation.processes.form.additional_info_placeholder"),
|
||||
hint: t("admin.legislation.processes.form.use_markdown") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-3 column clear end">
|
||||
<%= f.submit(class: "button success expanded", value: t("admin.legislation.processes.#{admin_submit_action(@process)}.submit_button")) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @question %>
|
||||
<%= render "shared/globalize_locales", resource: @question %>
|
||||
|
||||
<%= translatable_form_for [:admin, @process, @question], url: url, html: {data: {watch_changes: true}} do |f| %>
|
||||
|
||||
@@ -17,33 +17,37 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-9 column end">
|
||||
<%= translations_form.text_area :title,
|
||||
rows: 5,
|
||||
placeholder: t("admin.legislation.questions.form.title_placeholder"),
|
||||
label: t("admin.legislation.questions.form.title") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= f.label :question_options, t("admin.legislation.questions.form.question_options") %>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-9 column end">
|
||||
<%= translations_form.text_area :title,
|
||||
rows: 5,
|
||||
placeholder: t("admin.legislation.questions.form.title_placeholder"),
|
||||
label: t("admin.legislation.questions.form.title") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="nested_question_options">
|
||||
<%= f.fields_for :question_options do |ff| %>
|
||||
<%= render "question_option_fields", f: ff %>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= f.label :question_options, t("admin.legislation.questions.form.question_options") %>
|
||||
</div>
|
||||
|
||||
<div class="js-add-fields-container">
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= link_to_add_association t("admin.legislation.questions.form.add_option"),
|
||||
f, :question_options, class: "button hollow" %>
|
||||
<div id="nested_question_options">
|
||||
<%= f.fields_for :question_options do |ff| %>
|
||||
<%= render "question_option_fields", f: ff %>
|
||||
<% end %>
|
||||
|
||||
<div class="js-add-fields-container">
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= link_to_add_association t("admin.legislation.questions.form.add_option"),
|
||||
f, :question_options, class: "button hollow" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 large-3 clear column end margin-top">
|
||||
<%= f.submit(class: "button success expanded", value: t("admin.legislation.questions.#{admin_submit_action(@question)}.submit_button")) %>
|
||||
<div class="small-12 medium-6 large-3 clear column end margin-top">
|
||||
<%= f.submit(class: "button success expanded", value: t("admin.legislation.questions.#{admin_submit_action(@question)}.submit_button")) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -10,13 +10,15 @@
|
||||
|
||||
<%= render "admin/legislation/processes/subnav", process: @process, active: "questions" %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<h3 class="inline-block"><%= t("admin.legislation.questions.edit.title", question_title: @question.title) %></h3>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<h3 class="inline-block"><%= t("admin.legislation.questions.edit.title", question_title: @question.title) %></h3>
|
||||
|
||||
<div class="float-right">
|
||||
<%= link_to t("admin.legislation.questions.index.delete"), admin_legislation_process_question_path(@process, @question),
|
||||
method: :delete,
|
||||
class: "button hollow alert" %>
|
||||
<div class="float-right">
|
||||
<%= link_to t("admin.legislation.questions.index.delete"), admin_legislation_process_question_path(@process, @question),
|
||||
method: :delete,
|
||||
class: "button hollow alert" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
<h2><%= @process.title %></h2>
|
||||
|
||||
<%= render "admin/legislation/processes/subnav", process: @process, active: "questions" %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<h3><%= t("admin.legislation.questions.new.title") %></h3>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<h3><%= t("admin.legislation.questions.new.title") %></h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "form", url: admin_legislation_process_questions_path(@process) %>
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @active_poll %>
|
||||
<%= render "shared/globalize_locales", resource: @active_poll %>
|
||||
|
||||
<%= translatable_form_for(@active_poll, url: form_url) do |f| %>
|
||||
|
||||
<%= render "shared/errors", resource: @active_poll %>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="ckeditor">
|
||||
<span class="help-text"><%= t("admin.active_polls.form.description.help_text") %></span>
|
||||
<%= translations_form.cktext_area :description,
|
||||
maxlength: ActivePoll.description_max_length,
|
||||
label: t("admin.active_polls.form.description.text") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="ckeditor column">
|
||||
<span class="help-text"><%= t("admin.active_polls.form.description.help_text") %></span>
|
||||
<%= translations_form.cktext_area :description,
|
||||
maxlength: ActivePoll.description_max_length,
|
||||
label: t("admin.active_polls.form.description.text") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 large-2 margin-top">
|
||||
<%= f.submit(class: "button success", value: t("shared.save")) %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-4 large-2 margin-top column">
|
||||
<%= f.submit(class: "button success", value: t("shared.save")) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -1,44 +1,49 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @poll %>
|
||||
<%= render "shared/globalize_locales", resource: @poll %>
|
||||
|
||||
<%= translatable_form_for [:admin, @poll] do |f| %>
|
||||
<%= render "shared/errors", resource: @poll %>
|
||||
|
||||
<div class="clear">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :starts_at,
|
||||
value: @poll.starts_at.present? ? l(@poll.starts_at.to_date) : nil,
|
||||
class: "js-calendar-full" %>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="clear">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :starts_at,
|
||||
value: @poll.starts_at.present? ? l(@poll.starts_at.to_date) : nil,
|
||||
class: "js-calendar-full" %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :ends_at,
|
||||
value: @poll.ends_at.present? ? l(@poll.ends_at.to_date) : nil,
|
||||
class: "js-calendar-full" %>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :ends_at,
|
||||
value: @poll.ends_at.present? ? l(@poll.ends_at.to_date) : nil,
|
||||
class: "js-calendar-full" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= translations_form.text_field :name %>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= translations_form.text_field :name %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_area :summary, rows: 4 %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_area :summary, rows: 4 %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_area :description, rows: 8 %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= render "images/admin_image", imageable: @poll, f: f %>
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_area :description, rows: 8 %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="clear">
|
||||
<div class="small-6 medium-6 column">
|
||||
<%= f.check_box :geozone_restricted, data: { checkbox_toggle: "#geozones" } %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= render "images/admin_image", imageable: @poll, f: f %>
|
||||
</div>
|
||||
|
||||
<div class="clear">
|
||||
<div class="small-6 medium-6 column">
|
||||
<%= f.check_box :geozone_restricted, data: { checkbox_toggle: "#geozones" } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -54,10 +59,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clear">
|
||||
<div class="small-12 medium-4 large-2 column">
|
||||
<%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"),
|
||||
class: "button success expanded margin-top" %>
|
||||
<div class="row">
|
||||
<div class="clear">
|
||||
<div class="small-12 medium-4 large-2 column">
|
||||
<%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"),
|
||||
class: "button success expanded margin-top" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<div class="small-12 column">
|
||||
<%= back_link_to %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= back_link_to %>
|
||||
|
||||
<h2><%= t("admin.polls.new.title") %></h2>
|
||||
<h2><%= t("admin.polls.new.title") %></h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="polls-form">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @question %>
|
||||
<%= render "shared/globalize_locales", resource: @question %>
|
||||
|
||||
<%= translatable_form_for(@question, url: form_url) do |f| %>
|
||||
|
||||
@@ -6,25 +6,33 @@
|
||||
|
||||
<%= f.hidden_field :proposal_id %>
|
||||
|
||||
<div class="small-12">
|
||||
<% if @poll.present? %>
|
||||
<%= f.hidden_field :poll_id, value: @poll.id %>
|
||||
<% elsif @question.poll.present? %>
|
||||
<%= f.hidden_field :poll_id, value: @question.poll.id %>
|
||||
<% else %>
|
||||
<div class="small-12 medium-6 large-4">
|
||||
<% select_options = Poll.all.map { |p| [p.name, p.id] } %>
|
||||
<%= f.select :poll_id,
|
||||
options_for_select(select_options),
|
||||
prompt: t("admin.questions.index.select_poll"),
|
||||
label: t("admin.questions.new.poll_label") %>
|
||||
<div class="row">
|
||||
<div class="small-12">
|
||||
<% if @poll.present? %>
|
||||
<%= f.hidden_field :poll_id, value: @poll.id %>
|
||||
<% elsif @question.poll.present? %>
|
||||
<%= f.hidden_field :poll_id, value: @question.poll.id %>
|
||||
<% else %>
|
||||
<div class="small-12 medium-6 large-4 column">
|
||||
<% select_options = Poll.all.map { |p| [p.name, p.id] } %>
|
||||
<%= f.select :poll_id,
|
||||
options_for_select(select_options),
|
||||
prompt: t("admin.questions.index.select_poll"),
|
||||
label: t("admin.questions.new.poll_label") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="column">
|
||||
<%= translations_form.text_field :title %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.text_field :title %>
|
||||
<% end %>
|
||||
|
||||
<div class="row">
|
||||
<% if !@question.persisted? %>
|
||||
<%= fields_for :votation_type do |votation_f| %>
|
||||
<div class="small-12 medium-6">
|
||||
@@ -56,8 +64,10 @@
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 large-2 margin-top">
|
||||
<div class="row">
|
||||
<div class="small-12 medium-4 large-2 margin-top column">
|
||||
<%= f.submit(class: "button success expanded", value: t("shared.save")) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @answer %>
|
||||
<%= render "shared/globalize_locales", resource: @answer %>
|
||||
|
||||
<%= translatable_form_for(@answer, url: form_url) do |f| %>
|
||||
|
||||
@@ -9,16 +9,21 @@
|
||||
|
||||
<%= f.hidden_field :question_id, value: @answer.question_id || @question.id %>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.text_field :title %>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="column end">
|
||||
<%= translations_form.text_field :title %>
|
||||
</div>
|
||||
<div class="ckeditor column">
|
||||
<%= translations_form.cktext_area :description, maxlength: Poll::Question.description_max_length %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="ckeditor">
|
||||
<%= translations_form.cktext_area :description, maxlength: Poll::Question.description_max_length %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-4 large-2 margin-top column">
|
||||
<%= f.submit(class: "button success expanded", value: t("shared.save")) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-4 large-2 margin-top">
|
||||
<%= f.submit(class: "button success expanded", value: t("shared.save")) %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<div id="globalize_locales">
|
||||
<% I18n.available_locales.each do |locale| %>
|
||||
<div class="text-right">
|
||||
<%= link_to t("admin.translations.remove_language"), "#",
|
||||
id: "js_delete_#{locale}",
|
||||
style: display_translation_style(resource, locale),
|
||||
class: "delete js-delete-language",
|
||||
data: { locale: locale } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "admin/shared/globalize_tabs", resource: resource, display_style: display_style %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= select_tag :translation_locale,
|
||||
options_for_locale_select,
|
||||
prompt: t("admin.translations.add_language"),
|
||||
class: "js-globalize-locale" %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,3 +0,0 @@
|
||||
<%= render "admin/shared/common_globalize_locales",
|
||||
resource: resource,
|
||||
display_style: lambda { |locale| enable_translation_style(resource, locale) } %>
|
||||
@@ -1,11 +0,0 @@
|
||||
<ul class="tabs" data-tabs>
|
||||
<% I18n.available_locales.each do |locale| %>
|
||||
<li class="tabs-title">
|
||||
<%= link_to name_for_locale(locale), "#",
|
||||
style: display_style.call(locale),
|
||||
class: "js-globalize-locale-link #{highlight_class(resource, locale)}",
|
||||
data: { locale: locale },
|
||||
remote: true %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
@@ -1,3 +1,4 @@
|
||||
<%= render "admin/shared/common_globalize_locales",
|
||||
<%= render "shared/common_globalize_locales",
|
||||
resource: nil,
|
||||
display_style: lambda { |locale| site_customization_display_translation_style(locale) } %>
|
||||
display_style: lambda { |locale| site_customization_display_translation_style(locale) },
|
||||
manage_languages: defined?(manage_languages) ? manage_languages : true %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @page %>
|
||||
<%= render "shared/globalize_locales", resource: @page %>
|
||||
|
||||
<%= translatable_form_for [:admin, @page], html: {class: "edit_page", data: {watch_changes: true}} do |f| %>
|
||||
<% if @page.errors.any? %>
|
||||
@@ -13,41 +13,51 @@
|
||||
</strong>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
<div class="small-12 medium-4 column">
|
||||
<h3><%= t("admin.site_customization.pages.form.options") %></h3>
|
||||
<%= f.label :status %>
|
||||
<% ::SiteCustomization::Page::VALID_STATUSES.each do |status| %>
|
||||
<%= f.radio_button :status, status, label: false %>
|
||||
<%= f.label "status_#{status}", t("admin.site_customization.pages.page.status_#{status}") %>
|
||||
<br>
|
||||
<% end %>
|
||||
|
||||
<%= f.check_box :more_info_flag, class: "small" %>
|
||||
<%= f.check_box :print_content_flag %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.label :slug %>
|
||||
<p class="help-text"><%= t("admin.site_customization.pages.new.slug_help_html") %>
|
||||
<%= f.text_field :slug, label: false, size: 80, maxlength: 80 %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<h3><%= t("admin.site_customization.pages.form.options") %></h3>
|
||||
<%= f.label :status %>
|
||||
<% ::SiteCustomization::Page::VALID_STATUSES.each do |status| %>
|
||||
<%= f.radio_button :status, status, label: false %>
|
||||
<%= f.label "status_#{status}", t("admin.site_customization.pages.page.status_#{status}") %>
|
||||
<br>
|
||||
<% end %>
|
||||
|
||||
<%= f.check_box :more_info_flag, class: "small" %>
|
||||
<%= f.check_box :print_content_flag %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 column end">
|
||||
<%= translations_form.text_field :title %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_field :subtitle %>
|
||||
</div>
|
||||
<div class="ckeditor column">
|
||||
<%= translations_form.cktext_area :content,
|
||||
ckeditor: { language: I18n.locale, toolbar: "admin" } %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.label :slug %>
|
||||
<p class="help-text"><%= t("admin.site_customization.pages.new.slug_help_html") %>
|
||||
<%= f.text_field :slug, label: false, size: 80, maxlength: 80 %>
|
||||
</div>
|
||||
<div class="small-12 column">
|
||||
<hr>
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.text_field :title %>
|
||||
<%= translations_form.text_field :subtitle %>
|
||||
<div class="ckeditor">
|
||||
<%= translations_form.cktext_area :content,
|
||||
ckeditor: { language: I18n.locale, toolbar: "admin" } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-6 large-3 margin-top">
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 large-3 margin-top column">
|
||||
<%= f.submit class: "button success expanded" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
<% end %>
|
||||
|
||||
<%= back_link_to admin_site_customization_pages_path %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<h2 class="inline-block"><%= t("admin.site_customization.pages.edit.title", page_title: @page.title) %></h2>
|
||||
|
||||
<div class="small-12 column">
|
||||
<h2 class="inline-block"><%= t("admin.site_customization.pages.edit.title", page_title: @page.title) %></h2>
|
||||
|
||||
<%= link_to t("admin.site_customization.pages.index.delete"), admin_site_customization_page_path(@page), method: :delete, class: "delete float-right" %>
|
||||
<%= link_to t("admin.site_customization.pages.index.delete"), admin_site_customization_page_path(@page), method: :delete, class: "delete float-right" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "form" %>
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
<% end %>
|
||||
|
||||
<%= back_link_to admin_site_customization_pages_path %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<h2><%= t("admin.site_customization.pages.new.title") %></h2>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<h2><%= t("admin.site_customization.pages.new.title") %></h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "form" %>
|
||||
|
||||
@@ -1,41 +1,55 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @card %>
|
||||
<%= render "shared/globalize_locales", resource: @card %>
|
||||
|
||||
<%= translatable_form_for [:admin, @card] do |f| %>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-6">
|
||||
<%= translations_form.text_field :label %>
|
||||
</div>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-6 column end">
|
||||
<%= translations_form.text_field :label %>
|
||||
</div>
|
||||
|
||||
<%= translations_form.text_field :title %>
|
||||
<div class="column">
|
||||
<%= translations_form.text_field :title %>
|
||||
</div>
|
||||
|
||||
<%= translations_form.text_area :description, rows: 5 %>
|
||||
<div class="column">
|
||||
<%= translations_form.text_area :description, rows: 5 %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= translations_form.text_field :link_text %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.text_field :link_url %>
|
||||
<div class="small-12 medium-6 column end">
|
||||
<%= translations_form.text_field :link_text %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% unless @card.header? %>
|
||||
<%= f.label :columns %>
|
||||
<p class="help-text"><%= t("admin.site_customization.pages.cards.columns_help") %></p>
|
||||
<div class="small-12 medium-4 large-2">
|
||||
<%= f.select :columns, (1..12), label: false %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.text_field :link_url %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<% unless @card.header? %>
|
||||
<div class="column">
|
||||
<%= f.label :columns %>
|
||||
<p class="help-text"><%= t("admin.site_customization.pages.cards.columns_help") %></p>
|
||||
<div class="small-12 medium-4 large-2">
|
||||
<%= f.select :columns, (1..12), label: false %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.hidden_field :header, value: @card.header? %>
|
||||
<%= f.hidden_field :site_customization_page_id, value: @card.site_customization_page_id %>
|
||||
|
||||
<div class="image-form">
|
||||
<div class="image small-12 column">
|
||||
<%= render "images/nested_image", imageable: @card, f: f %>
|
||||
<div class="row">
|
||||
<div class="image-form">
|
||||
<div class="image small-12 column">
|
||||
<%= render "images/nested_image", imageable: @card, f: f %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<%= f.submit(t("admin.homepage.#{action_name}.#{@card.header? ? "submit_header" : "submit_card"}"), class: "button success") %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.submit(t("admin.homepage.#{action_name}.#{@card.header? ? "submit_header" : "submit_card"}"), class: "button success") %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,28 +1,36 @@
|
||||
<%= form_for(@investment, url: form_url, method: :post, html: { multipart: true }) do |f| %>
|
||||
<%= translatable_form_for(@investment, url: form_url, method: :post, html: { multipart: true }) do |f| %>
|
||||
|
||||
<%= render "shared/errors", resource: @investment %>
|
||||
|
||||
<div class="row">
|
||||
<div class="row column">
|
||||
<div class="small-12 medium-8 column">
|
||||
<%= f.select :heading_id, budget_heading_select_options(@budget), {include_blank: true, } %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.text_field :title,
|
||||
maxlength: Budget::Investment.title_max_length,
|
||||
data: { js_suggest_result: "js_suggest_result",
|
||||
js_suggest: "#js-suggest",
|
||||
js_url: suggest_budget_investments_path(@budget) } %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= render "shared/globalize_locales", resource: @investment %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="js-suggest"></div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_field :title,
|
||||
maxlength: Budget::Investment.title_max_length,
|
||||
data: { js_suggest_result: "js_suggest_result",
|
||||
js_suggest: ".js-suggest",
|
||||
js_url: suggest_budget_investments_path(@budget) } %>
|
||||
</div>
|
||||
<div class="js-suggest" data-locale="<%= translations_form.locale %>"></div>
|
||||
|
||||
<div class="ckeditor small-12 column">
|
||||
<%= translations_form.cktext_area :description,
|
||||
maxlength: Budget::Investment.description_max_length,
|
||||
ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= f.invisible_captcha :subtitle %>
|
||||
|
||||
<div class="ckeditor small-12 column">
|
||||
<%= f.cktext_area :description,
|
||||
maxlength: Budget::Investment.description_max_length,
|
||||
ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
|
||||
<% if feature?(:allow_images) %>
|
||||
<div class="images small-12 column">
|
||||
<%= render "images/nested_image", imageable: @investment, f: f %>
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
<%= form_for(@debate) do |f| %>
|
||||
<%= render "shared/globalize_locales", resource: @debate %>
|
||||
|
||||
<%= translatable_form_for(@debate) do |f| %>
|
||||
|
||||
<%= render "shared/errors", resource: @debate %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= f.label :title, t("debates.form.debate_title") %>
|
||||
<%= f.text_field :title, maxlength: Debate.title_max_length, placeholder: t("debates.form.debate_title"), label: false, data: {js_suggest_result: "js_suggest_result", js_suggest: "#js-suggest", js_url: suggest_debates_path}%>
|
||||
</div>
|
||||
<div id="js-suggest"></div>
|
||||
<div class="ckeditor small-12 column">
|
||||
<%= f.label :description, t("debates.form.debate_text") %>
|
||||
<%= f.cktext_area :description, maxlength: Debate.description_max_length, ckeditor: { language: I18n.locale }, label: false %>
|
||||
</div>
|
||||
<div class="row column">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_field :title,
|
||||
maxlength: Debate.title_max_length,
|
||||
placeholder: t("debates.form.debate_title"),
|
||||
data: { js_suggest_result: "js_suggest_result",
|
||||
js_suggest: ".js-suggest",
|
||||
js_url: suggest_debates_path } %>
|
||||
</div>
|
||||
<div class="js-suggest" data-locale="<%= translations_form.locale %>"></div>
|
||||
|
||||
<div class="ckeditor small-12 column">
|
||||
<%= translations_form.cktext_area :description,
|
||||
maxlength: Debate.description_max_length,
|
||||
ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= f.invisible_captcha :subtitle %>
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<header>
|
||||
<% if display_remote_translation_info?(@remote_translations, I18n.locale) %>
|
||||
<%= render "shared/remote_translations_button", remote_translations: @remote_translations %>
|
||||
<% end %>
|
||||
|
||||
<div class="top-links">
|
||||
<div class="row">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<% locals = { notification: notification,
|
||||
timestamp: notification.timestamp,
|
||||
title: notification.notifiable_title,
|
||||
body: notification.notifiable.try(:body) } %>
|
||||
body: notification.notifiable_body } %>
|
||||
<% link_text = render partial: "/notifications/notification_body", locals: locals %>
|
||||
<%= link_to_if notification.link.present?, link_text, notification.link %>
|
||||
<% else %>
|
||||
|
||||
@@ -1,32 +1,47 @@
|
||||
<%= form_for(@proposal, url: form_url) do |f| %>
|
||||
<%= render "shared/globalize_locales", resource: @proposal %>
|
||||
|
||||
<%= translatable_form_for(@proposal, url: form_url) do |f| %>
|
||||
|
||||
<%= render "shared/errors", resource: @proposal %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= f.label :title, t("proposals.form.proposal_title") %>
|
||||
<%= f.text_field :title, maxlength: Proposal.title_max_length, placeholder: t("proposals.form.proposal_title"), label: false, data: {js_suggest_result: "js_suggest_result", js_suggest: "#js-suggest", js_url: suggest_proposals_path}%>
|
||||
</div>
|
||||
<div id="js-suggest"></div>
|
||||
<div class="row column">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.text_field :title,
|
||||
maxlength: Proposal.title_max_length,
|
||||
placeholder: t("proposals.form.proposal_title"),
|
||||
data: { js_suggest_result: "js_suggest_result",
|
||||
js_suggest: ".js-suggest",
|
||||
js_url: suggest_proposals_path } %>
|
||||
</div>
|
||||
<div class="js-suggest" data-locale="<%= translations_form.locale %>"></div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= translations_form.label :summary %>
|
||||
<p class="help-text" id="<%= summary_help_text_id(translations_form) %>">
|
||||
<%= t("proposals.form.proposal_summary_note") %>
|
||||
</p>
|
||||
<%= translations_form.text_area :summary,
|
||||
rows: 4, maxlength: 200,
|
||||
label: false,
|
||||
placeholder: t("proposals.form.proposal_summary"),
|
||||
aria: {describedby: summary_help_text_id(translations_form)} %>
|
||||
</div>
|
||||
|
||||
<div class="ckeditor small-12 column">
|
||||
<%= translations_form.cktext_area :description,
|
||||
maxlength: Proposal.description_max_length,
|
||||
ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= f.invisible_captcha :subtitle %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.label :summary, t("proposals.form.proposal_summary") %>
|
||||
<p class="help-text" id="summary-help-text"><%= t("proposals.form.proposal_summary_note") %></p>
|
||||
<%= f.text_area :summary, rows: 4, maxlength: 200, label: false,
|
||||
placeholder: t("proposals.form.proposal_summary"),
|
||||
aria: {describedby: "summary-help-text"} %>
|
||||
</div>
|
||||
|
||||
<div class="ckeditor small-12 column">
|
||||
<%= f.label :description, t("proposals.form.proposal_text") %>
|
||||
<%= f.cktext_area :description, maxlength: Proposal.description_max_length, ckeditor: { language: I18n.locale }, label: false %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.label :video_url, t("proposals.form.proposal_video_url") %>
|
||||
<p class="help-text" id="video-url-help-text"><%= t("proposals.form.proposal_video_url_note") %></p>
|
||||
<%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false,
|
||||
<%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"),
|
||||
label: false,
|
||||
aria: {describedby: "video-url-help-text"} %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
<%= t("proposals.retire_form.warning") %>
|
||||
</div>
|
||||
|
||||
<%= form_for(@proposal, url: retire_proposal_path(@proposal)) do |f| %>
|
||||
<%= render "shared/globalize_locales", resource: @proposal, manage_languages: false %>
|
||||
|
||||
<%= translatable_form_for(@proposal, url: retire_proposal_path(@proposal)) do |f| %>
|
||||
<%= render "shared/errors", resource: @proposal %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 large-4 column">
|
||||
@@ -20,11 +22,13 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= f.label :retired_explanation, t("proposals.retire_form.retired_explanation_label") %>
|
||||
<%= f.text_area :retired_explanation, rows: 4, maxlength: 500, label: false,
|
||||
placeholder: t("proposals.retire_form.retired_explanation_placeholder") %>
|
||||
</div>
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-9 column float-left">
|
||||
<%= translations_form.text_area :retired_explanation,
|
||||
rows: 4, maxlength: 500,
|
||||
placeholder: t("proposals.retire_form.retired_explanation_placeholder") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
33
app/views/shared/_common_globalize_locales.html.erb
Normal file
33
app/views/shared/_common_globalize_locales.html.erb
Normal file
@@ -0,0 +1,33 @@
|
||||
<div class="row globalize-languages column padding-top <%= highlight_translation_html_class %>"
|
||||
data-zero-languages-description="<%= t("shared.translations.languages_in_use_html", count: 0) %>"
|
||||
data-one-languages-description="<%= t("shared.translations.languages_in_use_html", count: 1) %>"
|
||||
data-other-languages-description="<%= t("shared.translations.languages_in_use_html", count: 2) %>">
|
||||
<div class="small-6 large-3 column">
|
||||
<span class="small">
|
||||
<strong class="js-languages-description"><%= selected_languages_description(resource) %></strong>
|
||||
</span>
|
||||
<%= select_tag :select_language,
|
||||
options_for_select_language(resource),
|
||||
prompt: t("shared.translations.select_language_prompt"),
|
||||
class: "js-select-language" %>
|
||||
<%= select_language_error(resource) %>
|
||||
<div class="margin-bottom">
|
||||
<% if manage_languages %>
|
||||
<% I18n.available_locales.each do |locale| %>
|
||||
<%= link_to t("shared.translations.remove_language"), "#",
|
||||
style: display_destroy_locale_style(resource, locale),
|
||||
class: "delete js-delete-language js-delete-#{locale}",
|
||||
data: { locale: locale } %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="small-6 large-3 column margin-top end">
|
||||
<% if manage_languages %>
|
||||
<%= select_tag :add_language,
|
||||
options_for_add_language,
|
||||
prompt: t("shared.translations.add_language"),
|
||||
class: "js-add-language" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
6
app/views/shared/_globalize_locales.html.erb
Normal file
6
app/views/shared/_globalize_locales.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<% if translations_interface_enabled? %>
|
||||
<%= render "shared/common_globalize_locales",
|
||||
resource: resource,
|
||||
display_style: lambda { |locale| enable_translation_style(resource, locale) },
|
||||
manage_languages: defined?(manage_languages) ? manage_languages : true %>
|
||||
<% end %>
|
||||
11
app/views/shared/_remote_translations_button.html.erb
Normal file
11
app/views/shared/_remote_translations_button.html.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
<div class="remote-translations-button callout primary text-center">
|
||||
<% if display_remote_translation_button?(remote_translations) %>
|
||||
<%= form_tag remote_translations_path do %>
|
||||
<%= hidden_field_tag :remote_translations, remote_translations.to_json %>
|
||||
<%= t("remote_translations.text") %>
|
||||
<%= submit_tag t("remote_translations.button") %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= t("remote_translations.all_remote_translations_enqueued_text") %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,36 +1,45 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @milestone %>
|
||||
<%= render "shared/globalize_locales", resource: @milestone %>
|
||||
|
||||
<%= translatable_form_for [:tracking, *resource_hierarchy_for(@milestone)] do |f| %>
|
||||
|
||||
<div class="small-12 medium-6 margin-bottom">
|
||||
<%= f.select :status_id,
|
||||
@statuses.collect { |s| [s.name, s.id] },
|
||||
{ include_blank: @statuses.any? ? "" : t("tracking.milestones.form.no_statuses_defined") },
|
||||
{ disabled: @statuses.blank? } %>
|
||||
<%= link_to t("tracking.milestones.form.admin_statuses"),
|
||||
admin_milestone_statuses_path %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 margin-bottom column">
|
||||
<%= f.select :status_id,
|
||||
@statuses.collect { |s| [s.name, s.id] },
|
||||
{ include_blank: @statuses.any? ? "" : t("tracking.milestones.form.no_statuses_defined") },
|
||||
{ disabled: @statuses.blank? } %>
|
||||
<%= link_to t("tracking.milestones.form.admin_statuses"),
|
||||
admin_milestone_statuses_path %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.hidden_field :title, value: l(Time.current, format: :datetime),
|
||||
maxlength: Milestone.title_max_length %>
|
||||
|
||||
<%= translations_form.text_area :description,
|
||||
rows: 5,
|
||||
label: t("tracking.milestones.new.description") %>
|
||||
<% end %>
|
||||
|
||||
<%= f.label :publication_date, t("tracking.milestones.new.date") %>
|
||||
<%= f.text_field :publication_date,
|
||||
value: @milestone.publication_date.present? ? l(@milestone.publication_date.to_date) : nil,
|
||||
label: false,
|
||||
class: "js-calendar-full" %>
|
||||
|
||||
<%= render "images/admin_image", imageable: @milestone, f: f %>
|
||||
|
||||
<div class="documents">
|
||||
<%= render "documents/nested_documents", documentable: @milestone, f: f %>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="column">
|
||||
<%= translations_form.hidden_field :title, value: l(Time.current, format: :datetime),
|
||||
maxlength: Milestone.title_max_length %>
|
||||
<%= translations_form.text_area :description,
|
||||
rows: 5,
|
||||
label: t("tracking.milestones.new.description") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.submit nil, class: "button success" %>
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<%= f.label :publication_date, t("tracking.milestones.new.date") %>
|
||||
<%= f.text_field :publication_date,
|
||||
value: @milestone.publication_date.present? ? l(@milestone.publication_date.to_date) : nil,
|
||||
label: false,
|
||||
class: "js-calendar-full" %>
|
||||
|
||||
<%= render "images/admin_image", imageable: @milestone, f: f %>
|
||||
|
||||
<div class="documents">
|
||||
<%= render "documents/nested_documents", documentable: @milestone, f: f %>
|
||||
</div>
|
||||
|
||||
<%= f.submit nil, class: "button success" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,31 +1,40 @@
|
||||
<%= render "admin/shared/globalize_locales", resource: @progress_bar %>
|
||||
<%= render "shared/globalize_locales", resource: @progress_bar %>
|
||||
|
||||
<%= translatable_form_for [:tracking, *resource_hierarchy_for(@progress_bar)] do |f| %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.enum_select :kind %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.enum_select :kind %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-6">
|
||||
<%= translations_form.text_field :title %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-6 column end">
|
||||
<%= translations_form.text_field :title %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% progress_options = { min: ProgressBar::RANGE.min, max: ProgressBar::RANGE.max, step: 1 } %>
|
||||
<div class="small-12 medium-6 large-2">
|
||||
<%= f.text_field :percentage, { type: :range,
|
||||
id: "percentage_range",
|
||||
class: "column" }.merge(progress_options) %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 large-2">
|
||||
<div class="input-group">
|
||||
<%= f.text_field :percentage, { type: :number,
|
||||
label: false,
|
||||
class: "input-group-field" }.merge(progress_options) %>
|
||||
<span class="input-group-label">%</span>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 large-2 column">
|
||||
<%= f.text_field :percentage, { type: :range,
|
||||
id: "percentage_range",
|
||||
class: "column" }.merge(progress_options) %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 large-2 column">
|
||||
<div class="input-group">
|
||||
<%= f.text_field :percentage, { type: :number,
|
||||
label: false,
|
||||
class: "input-group-field" }.merge(progress_options) %>
|
||||
<span class="input-group-label">%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<%= f.submit nil, class: "button success" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.submit nil, class: "button success" %>
|
||||
<% end %>
|
||||
|
||||
@@ -57,7 +57,10 @@ module Consul
|
||||
config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**", "*.{rb,yml}")]
|
||||
config.i18n.load_path += Dir[Rails.root.join("config", "locales", "custom", "**", "*.{rb,yml}")]
|
||||
|
||||
config.after_initialize { Globalize.set_fallbacks_to_all_available_locales }
|
||||
config.after_initialize do
|
||||
Globalize.set_fallbacks_to_all_available_locales
|
||||
GraphQLApi::Loader.setup
|
||||
end
|
||||
|
||||
config.assets.paths << Rails.root.join("app", "assets", "fonts")
|
||||
config.assets.paths << Rails.root.join("vendor", "assets", "fonts")
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
if ActiveRecord::Base.connection.tables.any?
|
||||
api_config = YAML.load_file("./config/api.yml")
|
||||
API_TYPE_DEFINITIONS = GraphQL::ApiTypesCreator::parse_api_config_file(api_config)
|
||||
end
|
||||
11
config/initializers/graphql_api.rb
Normal file
11
config/initializers/graphql_api.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
module GraphQLApi
|
||||
class Loader
|
||||
def self.setup
|
||||
if ActiveRecord::Base.connection.tables.any?
|
||||
api_config = YAML.load_file("./config/api.yml")
|
||||
GraphqlController.const_set "API_TYPE_DEFINITIONS",
|
||||
GraphQL::ApiTypesCreator::parse_api_config_file(api_config)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -106,7 +106,7 @@ de:
|
||||
confidence_score: am besten bewertet
|
||||
price: nach Preis
|
||||
share:
|
||||
message: "Ich habe einen Ausgabenvorschlag %{title} in %{org} erstellt. Erstellen Sie auch einen Ausgabenvorschlag!"
|
||||
message: "Ich habe einen Ausgabenvorschlag %{title} in %{handle} erstellt. Erstellen Sie auch einen Ausgabenvorschlag!"
|
||||
show:
|
||||
author_deleted: Benutzer gelöscht
|
||||
price_explanation: Preiserklärung
|
||||
|
||||
@@ -150,6 +150,9 @@ en:
|
||||
organization_name: "If you are proposing in the name of a collective/organization, or on behalf of more people, write its name"
|
||||
image: "Proposal descriptive image"
|
||||
image_title: "Image title"
|
||||
budget/investment/translation:
|
||||
title: "Title"
|
||||
description: "Description"
|
||||
geozone:
|
||||
name: Name
|
||||
external_code: "External code (optional)"
|
||||
@@ -182,6 +185,9 @@ en:
|
||||
description: "Opinion"
|
||||
terms_of_service: "Terms of service"
|
||||
title: "Title"
|
||||
debate/translation:
|
||||
title: "Debate title"
|
||||
description: "Initial debate text"
|
||||
proposal:
|
||||
author: "Author"
|
||||
title: "Title"
|
||||
@@ -189,6 +195,11 @@ en:
|
||||
description: "Description"
|
||||
selected: "Mark as selected"
|
||||
terms_of_service: "Terms of service"
|
||||
proposal/translation:
|
||||
title: "Proposal title"
|
||||
description: "Proposal text"
|
||||
summary: "Proposal summary"
|
||||
retired_explanation: "Explanation"
|
||||
user:
|
||||
login: "Email or username"
|
||||
email: "Email"
|
||||
@@ -437,6 +448,7 @@ en:
|
||||
valuation:
|
||||
cannot_comment_valuation: "You cannot comment a valuation"
|
||||
messages:
|
||||
translations_too_short: Is mandatory to provide one translation at least
|
||||
record_invalid: "Validation failed: %{errors}"
|
||||
another_poll_active: There is another poll active for the given period
|
||||
restrict_dependent_destroy:
|
||||
|
||||
@@ -1630,9 +1630,6 @@ en:
|
||||
submit_header: Save header
|
||||
card_title: Edit card
|
||||
submit_card: Save card
|
||||
translations:
|
||||
remove_language: Remove language
|
||||
add_language: Add language
|
||||
change_log:
|
||||
title: "Change Log"
|
||||
id: "ID"
|
||||
|
||||
@@ -101,7 +101,6 @@ en:
|
||||
submit_button: Save changes
|
||||
show_link: View debate
|
||||
form:
|
||||
debate_text: Initial debate text
|
||||
debate_title: Debate title
|
||||
tags_instructions: Tag this debate.
|
||||
tags_label: Topics
|
||||
@@ -333,7 +332,6 @@ en:
|
||||
warning: "If you retire the proposal it would still accept supports, but will be removed from the main list and a message will be visible to all users stating that the author considers the proposal should not be supported anymore"
|
||||
retired_reason_label: Reason to retire the proposal
|
||||
retired_reason_blank: Choose an option
|
||||
retired_explanation_label: Explanation
|
||||
retired_explanation_placeholder: Explain shortly why you think this proposal should not receive more supports
|
||||
submit_button: Retire proposal
|
||||
retire_options:
|
||||
@@ -827,6 +825,14 @@ en:
|
||||
legislation_process: "Download legislation processes"
|
||||
budget: "Download budgets"
|
||||
investments: "Download projects"
|
||||
translations:
|
||||
select_language_prompt: Choose language
|
||||
remove_language: Remove language
|
||||
add_language: Add language
|
||||
languages_in_use_html:
|
||||
zero: "<span class='js-languages-count'>0</span> languages in use"
|
||||
one: "<span class='js-languages-count'>1</span> language in use"
|
||||
other: "<span class='js-languages-count'>%{count}</span> languages in use"
|
||||
social:
|
||||
facebook: "%{org} Facebook"
|
||||
twitter: "%{org} Twitter"
|
||||
@@ -1035,3 +1041,9 @@ en:
|
||||
title: Prioritization type
|
||||
borda: Borda votation
|
||||
dowdall: Dowdall votation
|
||||
remote_translations:
|
||||
text: The content of this page is not available in your language
|
||||
all_remote_translations_enqueued_text: In a short period of time refreshing the page you will be able to see all the content in your language.
|
||||
create:
|
||||
enqueue_remote_translation: Translations have been correctly requested.
|
||||
button: Translate page
|
||||
|
||||
@@ -116,6 +116,10 @@ en:
|
||||
public_stats_description: "Display public stats in the Administration panel"
|
||||
help_page: "Help page"
|
||||
help_page_description: 'Displays a Help menu that contains a page with an info section about each enabled feature. Also custom pages and menus can be created in the "Custom pages" and "Custom content blocks" sections'
|
||||
remote_translations: "Remote translation"
|
||||
remote_translations_description: "Displays a button that allows users to request a translation when there are not contents in their language."
|
||||
translation_interface: "Translation interface"
|
||||
translation_interface_description: "Displays the manual translation interface that allows users to enter their content in all application available languages. This option only affects user application forms and independently will always be active in the administration panel."
|
||||
valuation_comment_notification: "Valuation comment notification"
|
||||
valuation_comment_notification_description: "Send an email to all associated users except valuation commenter to budget investment when a new valuation comment is created"
|
||||
map:
|
||||
|
||||
@@ -152,6 +152,9 @@ es:
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, o en nombre de más gente, escribe su nombre"
|
||||
image: "Imagen descriptiva del proyecto de gasto"
|
||||
image_title: "Título de la imagen"
|
||||
budget/investment/translation:
|
||||
title: "Título"
|
||||
description: "Descripción"
|
||||
geozone:
|
||||
name: Nombre
|
||||
external_code: "Código externo (opcional)"
|
||||
@@ -183,7 +186,10 @@ es:
|
||||
author: "Autor"
|
||||
description: "Opinión"
|
||||
terms_of_service: "Términos de servicio"
|
||||
title: "Título"
|
||||
title: "Título del debate"
|
||||
debate/translation:
|
||||
title: "Título del debate"
|
||||
description: "Texto inicial del debate"
|
||||
proposal:
|
||||
author: "Autor"
|
||||
title: "Título"
|
||||
@@ -191,6 +197,11 @@ es:
|
||||
description: "Descripción"
|
||||
selected: "Marcar como seleccionada"
|
||||
terms_of_service: "Términos de servicio"
|
||||
proposal/translation:
|
||||
title: "Título de la propuesta"
|
||||
description: "Texto desarrollado de la propuesta"
|
||||
summary: "Resumen de la propuesta"
|
||||
retired_explanation: "Explicación"
|
||||
user:
|
||||
login: "Email o nombre de usuario"
|
||||
email: "Email"
|
||||
@@ -439,6 +450,7 @@ es:
|
||||
valuation:
|
||||
cannot_comment_valuation: "No puedes comentar una evaluación"
|
||||
messages:
|
||||
translations_too_short: El obligatorio proporcionar una traducción como mínimo
|
||||
record_invalid: "Error de validación: %{errors}"
|
||||
another_poll_active: Hay otra encuesta activa para este periodo.
|
||||
restrict_dependent_destroy:
|
||||
|
||||
@@ -1628,9 +1628,6 @@ es:
|
||||
submit_header: Guardar encabezado
|
||||
card_title: Editar tarjeta
|
||||
submit_card: Guardar tarjeta
|
||||
translations:
|
||||
remove_language: Eliminar idioma
|
||||
add_language: Añadir idioma
|
||||
change_log:
|
||||
title: "Historial"
|
||||
id: "ID"
|
||||
|
||||
@@ -101,7 +101,6 @@ es:
|
||||
submit_button: Guardar cambios
|
||||
show_link: Ver debate
|
||||
form:
|
||||
debate_text: Texto inicial del debate
|
||||
debate_title: Título del debate
|
||||
tags_instructions: Etiqueta este debate.
|
||||
tags_label: Temas
|
||||
@@ -333,7 +332,6 @@ es:
|
||||
warning: "Si sigues adelante tu propuesta podrá seguir recibiendo apoyos, pero dejará de ser listada en la lista principal, y aparecerá un mensaje para todos los usuarios avisándoles de que el autor considera que esta propuesta no debe seguir recogiendo apoyos."
|
||||
retired_reason_label: Razón por la que se retira la propuesta
|
||||
retired_reason_blank: Selecciona una opción
|
||||
retired_explanation_label: Explicación
|
||||
retired_explanation_placeholder: Explica brevemente por que consideras que esta propuesta no debe recoger más apoyos
|
||||
submit_button: Retirar propuesta
|
||||
retire_options:
|
||||
@@ -824,6 +822,14 @@ es:
|
||||
legislation_process: "Descargar procesos legislativos"
|
||||
budget: "Descargar presupuestos"
|
||||
investments: "Descargar proyectos"
|
||||
translations:
|
||||
select_language_prompt: Seleccionar idioma
|
||||
remove_language: Eliminar idioma
|
||||
add_language: Añadir idioma
|
||||
languages_in_use_html:
|
||||
zero: "<span class='js-languages-count'>0</span> idiomas en uso"
|
||||
one: "<span class='js-languages-count'>1</span> idioma en uso"
|
||||
other: "<span class='js-languages-count'>%{count}</span> idiomas en uso"
|
||||
social:
|
||||
facebook: "Facebook de %{org}"
|
||||
twitter: "Twitter de %{org}"
|
||||
@@ -1032,3 +1038,9 @@ es:
|
||||
title: Tipo de priorizacion
|
||||
borda: Votación con recuento Borda
|
||||
dowdall: Votación con recuento Dowdall
|
||||
remote_translations:
|
||||
text: El contenido de esta página no está disponible en tu idioma
|
||||
all_remote_translations_enqueued_text: "En un breve periodo de tiempo refrescando la página podrá ver todo el contenido en su idioma"
|
||||
create:
|
||||
enqueue_remote_translation: Se han solicitado correctamente las traducciones.
|
||||
button: Traducir página
|
||||
|
||||
@@ -116,6 +116,10 @@ es:
|
||||
public_stats_description: "Muestra las estadísticas públicas en el panel de Administración"
|
||||
help_page: "Página de ayuda"
|
||||
help_page_description: 'Muestra un menú Ayuda que contiene una página con una sección de información sobre cada funcionalidad habilitada. También se pueden crear páginas y menús personalizados en las secciones "Personalizar páginas" y "Personalizar bloques"'
|
||||
remote_translations: "Traducciones remotas"
|
||||
remote_translations_description: "Muestra un botón que permite a los usuarios solicitar una traducción de una página no traducida en su idioma."
|
||||
translation_interface: "Interfaz de traducción"
|
||||
translation_interface_description: "Muestra la interfaz de traducción manual permitiendo a los usuarios introducir sus contenidos en todos los idiomas disponibles de la aplicación si así lo desean. Esta opción solo afecta a las vistas de usuarios de la aplicación, en el panel de administración está activa siempre."
|
||||
valuation_comment_notification: "Notificar comentarios de evaluación"
|
||||
valuation_comment_notification_description: "Envía un email a todos los usuarios menos al que haya comentado asociados a un presupuesto participativo cuando se cree un nuevo comentario de evaluación"
|
||||
map:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user