diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index 1df510eec..dab6801d2 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -26,7 +26,7 @@ module CommentableActions set_resource_instance load_featured_tags load_category_tags - load_district_tags + load_district_select end def create @@ -36,13 +36,13 @@ module CommentableActions if @resource.save_with_captcha track_event load_category_tags - load_district_tags + load_district_select redirect_path = url_for(controller: controller_name, action: :show, id: @resource.id) redirect_to redirect_path, notice: t('flash.actions.create.notice', resource_name: "#{resource_name.capitalize}") else load_featured_tags load_category_tags - load_district_tags + load_district_select set_resource_instance render :new end @@ -51,7 +51,7 @@ module CommentableActions def edit load_featured_tags load_category_tags - load_district_tags + load_district_select end def update @@ -61,7 +61,7 @@ module CommentableActions else load_featured_tags load_category_tags - load_district_tags + load_district_select set_resource_instance render :edit end @@ -85,11 +85,11 @@ module CommentableActions where("kind = 'category' and tags.featured = true"). order(kind: :asc, id: :asc) end - def load_district_tags - @district_tags = ActsAsTaggableOn::Tag.select("tags.*"). - where("kind = 'district' and tags.featured = true"). - order(kind: :asc, id: :asc) + def load_district_select + @district_select = Geozone.select("geozones.name, geozones.id"). + order(id: :asc) end + def parse_tag_filter if params[:tag].present? @tag_filter = params[:tag] if ActsAsTaggableOn::Tag.named(params[:tag]).exists? diff --git a/app/views/debates/_form.html.erb b/app/views/debates/_form.html.erb index 1693fb7bf..21fc4891f 100644 --- a/app/views/debates/_form.html.erb +++ b/app/views/debates/_form.html.erb @@ -20,12 +20,10 @@ <% @category_tags.each do |tag| %> <%= tag.name %> <% end %> -
<%= f.label :tag_list, t("debates.form.tag_district_label") %> - <% @district_tags.each do |tag| %> - <%= tag.name %> + <% @district_select.each do |g| %> + <%= g.name%> <% end %> - <%= f.text_field :tag_list, value: @debate.tag_list.to_s, label: false, placeholder: t("debates.form.tags_placeholder"), class: 'js-tag-list' %> diff --git a/app/views/proposals/_form.html.erb b/app/views/proposals/_form.html.erb index ad4554599..78a41295a 100644 --- a/app/views/proposals/_form.html.erb +++ b/app/views/proposals/_form.html.erb @@ -47,15 +47,14 @@ <% @category_tags.each do |tag| %> <%= tag.name %> <% end %> -
- <%= f.label :district_tag_list, t("proposals.form.tag_district_label") %> - <% @district_tags.each do |tag| %> - <%= tag.name %> + <%= f.label :district_tag_list, t("proposals.form.tag_district_label") %> + <% @district_select.each do |g| %> + <%= g.name %> <% end %> +
<%= f.text_field :tag_list, value: @proposal.tag_list.to_s, label: false, placeholder: t("proposals.form.tags_placeholder"), class: 'js-tag-list' %> - <% if current_user.unverified? %>
<%= f.label :responsible_name, t("proposals.form.proposal_responsible_name") %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 7b2361b4e..b6fd77c29 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -210,11 +210,11 @@ en: proposal_video_url_note: "You may add a link to YouTube or Vimeo" proposal_responsible_name: "Full name of the person submitting the proposal" proposal_responsible_name_note: "(individually or as representative of a collective; will not be displayed publically)" - tags_label: "Tags" - tags_instructions: "Tag this proposal. You can choose from Categories and Districs tags or add your own" + tags_label: "Topics" + tags_instructions: "Tag this proposal. You can choose from Categories and Districs suggestions or enter your own" tags_placeholder: "Enter the tags you would like to use, separated by commas (',')" - tag_category_label: "Category" - tag_district_label: "District" + tag_category_label: "Categories" + tag_district_label: "Districts" show: back_link: "Go back" author_deleted: "User deleted" diff --git a/config/locales/es.yml b/config/locales/es.yml index efd750781..0c09bc348 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -211,10 +211,10 @@ es: proposal_responsible_name: "Nombre y apellidos de la persona que hace esta propuesta" proposal_responsible_name_note: "(individualmente o como representante de un colectivo; no se mostrará públicamente)" tags_label: "Temas" - tags_instructions: "Etiqueta esta propuesta. Puedes elegir entre nuestras sugerencias o introducir las que desees." - tags_placeholder: "Escribe las etiquetas que desees separadas por una coma (',')" tag_category_label: "Categorías" tag_district_label: "Distritos" + tags_instructions: "Etiqueta esta propuesta. Puedes elegir entre Categorias y Distritos propuestos o introducir las que desees" + tags_placeholder: "Escribe las etiquetas que desees separadas por una coma (',')" show: back_link: "Volver" author_deleted: "Usuario eliminado" diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index 47fc39300..6fe45bde9 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -231,40 +231,33 @@ Proposal.only_hidden.flagged.reorder("RANDOM()").limit(5).each(&:confirm_hide) puts "Creating Tags Categories" ActsAsTaggableOn::Tag.create!(name: "Asociaciones", featured: true, kind: "category") +puts " Asociaciones" ActsAsTaggableOn::Tag.create!(name: "Cultura", featured: true, kind: "category") +puts " Cultura" ActsAsTaggableOn::Tag.create!(name: "Deportes", featured: true, kind: "category") -ActsAsTaggableOn::Tag.create!(name: "Derechos Sociales", featured: true, kind: "category") +puts " Deportes" +ActsAsTaggableOn::Tag.create!(name: "Derechos SMedio Ambienteociales", featured: true, kind: "category") +puts " Derechos Sociales" ActsAsTaggableOn::Tag.create!(name: "Economía", featured: true, kind: "category") +puts " Economía" ActsAsTaggableOn::Tag.create!(name: "Empleo", featured: true, kind: "category") +puts " Empleo" ActsAsTaggableOn::Tag.create!(name: "Equidad", featured: true, kind: "category") +puts " Equidad" ActsAsTaggableOn::Tag.create!(name: "Sostenibilidad", featured: true, kind: "category") +puts " Sostenibilidad" ActsAsTaggableOn::Tag.create!(name: "Participación", featured: true, kind: "category") +puts " Participación" ActsAsTaggableOn::Tag.create!(name: "Movilidad", featured: true, kind: "category") +puts " Movilidad" ActsAsTaggableOn::Tag.create!(name: "Medios", featured: true, kind: "category") +puts " Medios" ActsAsTaggableOn::Tag.create!(name: "Salud", featured: true , kind: "category") +puts " Salud" ActsAsTaggableOn::Tag.create!(name: "Transparencia", featured: true, kind: "category") +puts " Transparencia" ActsAsTaggableOn::Tag.create!(name: "Seguridad y Emergencias", featured: true, kind: "category") +puts " Seguridad y Emergencias" ActsAsTaggableOn::Tag.create!(name: "Medio Ambiente", featured: true, kind: "category") +puts " Medio Ambiente" -puts "Creating Tags Districts" - -ActsAsTaggableOn::Tag.create!(name: "Centro", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Arganzuela", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Retiro" , featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Salamanca" , featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Chamartín" , featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Tetuán" , featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Chamberí" , featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Moncloa-Aravaca", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Latina", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Carabanchel", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Usera", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Puente de Vallecas", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Moratalaz", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Ciudad Lineal", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Hortaleza", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Villaverde", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Villa de Vallecas", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Vicalvaro", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "San Blas-Canillejas", featured: true, kind: "district") -ActsAsTaggableOn::Tag.create!(name: "Barajas", featured: true, kind: "district") diff --git a/db/schema.rb b/db/schema.rb index 9578a4763..b0870098d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,6 @@ # # It's strongly recommended that you check this file into your version control system. - ActiveRecord::Schema.define(version: 20160108133501) do # These are extensions that must be enabled in order to support this database @@ -200,7 +199,7 @@ ActiveRecord::Schema.define(version: 20160108133501) do create_table "locks", force: :cascade do |t| t.integer "user_id" t.integer "tries", default: 0 - t.datetime "locked_until", default: '2000-01-01 00:01:01', null: false + t.datetime "locked_until", default: '2000-01-01 07:01:01', null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false end @@ -311,12 +310,12 @@ ActiveRecord::Schema.define(version: 20160108133501) do add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree create_table "tags", force: :cascade do |t| - t.string "name", limit: 40 - t.integer "taggings_count", default: 0 - t.boolean "featured", default: false - t.integer "debates_count", default: 0 - t.integer "proposals_count", default: 0 - t.string "kind", limit: 40 + t.string "name", limit: 40 + t.integer "taggings_count", default: 0 + t.boolean "featured", default: false + t.integer "debates_count", default: 0 + t.integer "proposals_count", default: 0 + t.string "kind", limit: 40 t.integer "spending_proposals_count", default: 0 end