Diaspora field added to all organisations. Refs #28

This commit is contained in:
echarp 2016-01-07 22:20:09 +01:00
parent bc810ded71
commit 8b1e967e35
11 changed files with 102 additions and 55 deletions

View File

@ -2,7 +2,7 @@
@import font-awesome-sprockets
@import font-awesome
.events form, .moderations form, .orgas form, .digests form
.events form, .moderations form, .orgas, .digests form
.field, .actions
max-width: 70em
text-align: left
@ -42,7 +42,7 @@
.mce-panel.mce-last
+border-bottom-right-radius(0.4em)
.field label:before
.field label:before, th:before, th a:before
color: gray
margin-right: 0.4em
+fa-icon()
@ -58,11 +58,11 @@
content: $fa-var-flag
.field.address label:before
content: $fa-var-map-marker
.field.city label:before
.field.city label:before, th.city a:before
content: $fa-var-compress
.field.department label:before
.field.department label:before, th.department a:before
content: $fa-var-puzzle-piece
.field.region label:before
.field.region label:before, th.region a:before
content: $fa-var-shield
.field.locality > label:before
content: $fa-var-expand
@ -70,16 +70,18 @@
content: $fa-var-envelope
.field.submitter label:before
content: $fa-var-envelope-o
.field.url label:before
.field.url label:before, th.url:before
content: $fa-var-external-link
.field.tags label:before
.field.diaspora label:before, th.diaspora:before
content: $fa-var-bullhorn
.field.tags label:before, th.tags a:before
content: $fa-var-tags
.field.active label:before
content: $fa-var-heartbeat
.field.kind > label:before
.field.kind > label:before, th.kind:before
content: $fa-var-cubes
.field.feed label:before
.field.feed label:before, th.feed:before
content: $fa-var-rss
.field .radios label

View File

@ -92,7 +92,8 @@ class OrgasController < ApplicationController
def orga_params
params.require(:orga)
.permit :lock_version, :kind_id, :name, :description, :city, :department,
:region_id, :url, :feed, :contact, :submitter, :tags, :active
:region_id, :url, :diaspora, :feed, :contact, :submitter, :tags,
:active
end
# Check that you can only edit an existing event if you know its secret

View File

@ -9,6 +9,7 @@ class Orga < ActiveRecord::Base
validates :name, presence: true
validates :region, presence: true
validates :url, format: %r{\Ahttps?:\/\/.*\..*\z}
validates :diaspora, allow_blank: true, format: %r{\Ahttps?:\/\/.*\..*\z}
validates :feed, allow_blank: true, format: %r{\Ahttps?:\/\/.*\..*\z}
validates :contact, allow_blank: true, email: true
validates :submitter, allow_blank: true, email: true

View File

@ -40,6 +40,9 @@
#{t '.url_helper'}
= f.label :url
= f.url_field :url, placeholder: 'Ex: http://april.org'
.field.diaspora
= f.label :diaspora
= f.url_field :diaspora
.field.feed
.helper
:markdown

View File

@ -1,7 +1,7 @@
= search_form_for @search || Orga.search(params[:q]) do |f|
= f.label :search, t('.label')
%em.fa.fa-users
= f.search_field :name_or_city_or_department_or_region_name_or_url_or_tags_cont_any,
= f.search_field :name_or_city_or_department_or_region_name_or_url_or_diaspora_or_tags_cont_any,
id: :q_search, size: 16,
placeholder: t('.title', entity: Orga.model_name.human)
= f.button class: :search do

View File

@ -7,16 +7,18 @@
%table.list.autopagerize_page_element
%thead
%th= sort_link @search, :kind_name, Orga.human_attribute_name(:kind)
%th= sort_link @search, :name
%th= sort_link @search, :city
%th= sort_link @search, :department
%th= sort_link @search, :region_name, Orga.human_attribute_name(:region)
%th= sort_link @search, :tags, Orga.human_attribute_name(:tags)
%th= sort_link @search, :updated_at, Orga.human_attribute_name(:updated_at)
%th/
%th/
%th/
%th.kind= sort_link @search, :kind_name, Orga.human_attribute_name(:kind)
%th.name= sort_link @search, :name
%th.city= sort_link @search, :city
%th.department= sort_link @search, :department
%th.region= sort_link @search, :region_name, Orga.human_attribute_name(:region)
%th.tags= sort_link @search, :tags, Orga.human_attribute_name(:tags)
%th.updated_at= sort_link @search, :updated_at, Orga.human_attribute_name(:updated_at)
%th.url/
%th.diaspora/
%th.feed/
%th.view/
%th.edit/
%tbody
- @orgas.each do |orga|
@ -37,8 +39,17 @@
- if orga.updated_at.present?
= l orga.updated_at.to_date
%td
- if orga.url.present?
= link_to orga.url do
%em.fa.fa-external-link
%em.fa.fa-external-link(title="#{Orga.human_attribute_name(:url)}")
%td
- if orga.diaspora.present?
= link_to orga.diaspora do
%em.fa.fa-bullhorn(title="#{Orga.human_attribute_name(:diaspora)}")
%td
- if orga.feed.present?
= link_to orga.feed do
%em.fa.fa-rss(title="#{Orga.human_attribute_name(:feed)}")
%td
= link_to orga_path(orga, q: params[:q], page: params[:page]) do
%em.fa.fa-eye

View File

@ -84,6 +84,11 @@
%em.fa.fa-external-link
= Orga.human_attribute_name :url
%dd= link_to @orga.url, @orga.url
- if @orga.diaspora.present?
%dt
%em.fa.fa-bullhorn
= Orga.human_attribute_name :diaspora
%dd= link_to @orga.url, @orga.url
- if @orga.feed.present?
%dt
%em.fa.fa-rss

View File

@ -74,8 +74,6 @@ en:
all: All regions
note:
contents: Your comment
orga:
tags: Tags
i18n/backend/active_record/translation:
locale: Language
key: Key

View File

@ -74,8 +74,6 @@ fr:
all: Toutes les régions
note:
contents: Votre commentaire
orga:
tags: Mots-clés
i18n/backend/active_record/translation:
locale: Langue
key: Clé

View File

@ -0,0 +1,6 @@
# Adding a diaspora URL to organisations
class AddDiasporaToOrga < ActiveRecord::Migration
def change
add_column :orgas, :diaspora, :text
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160103141244) do
ActiveRecord::Schema.define(version: 20160107203117) do
create_table "active_admin_comments", force: :cascade do |t|
t.string "namespace", limit: 255
@ -24,9 +24,9 @@ ActiveRecord::Schema.define(version: 20160103141244) do
t.datetime "updated_at"
end
add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree
add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree
add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree
add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id"
add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace"
add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id"
create_table "admin_users", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false
@ -43,8 +43,8 @@ ActiveRecord::Schema.define(version: 20160103141244) do
t.datetime "updated_at"
end
add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree
add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree
add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true
add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
create_table "cities", force: :cascade do |t|
t.string "name", limit: 255, default: "", null: false
@ -56,7 +56,7 @@ ActiveRecord::Schema.define(version: 20160103141244) do
t.float "longitude", limit: 24
end
add_index "cities", ["name"], name: "cities_name", using: :btree
add_index "cities", ["name"], name: "cities_name"
create_table "events", force: :cascade do |t|
t.string "title", limit: 255, default: "", null: false
@ -72,8 +72,8 @@ ActiveRecord::Schema.define(version: 20160103141244) do
t.integer "moderated", limit: 4, default: 0, null: false
t.string "tags", limit: 255, default: "", null: false
t.string "secret", limit: 255, default: "", null: false
t.datetime "decision_time", null: false
t.datetime "submission_time", null: false
t.datetime "decision_time"
t.datetime "submission_time"
t.string "moderator_mail_id", limit: 32
t.string "submitter_mail_id", limit: 32
t.text "address", limit: 65535
@ -83,7 +83,7 @@ ActiveRecord::Schema.define(version: 20160103141244) do
t.string "place_name", limit: 255
end
add_index "events", ["start_time", "end_time"], name: "events_date", using: :btree
add_index "events", ["start_time", "end_time"], name: "events_date"
create_table "kinds", force: :cascade do |t|
t.string "name", limit: 255, null: false
@ -101,7 +101,7 @@ ActiveRecord::Schema.define(version: 20160103141244) do
create_table "orgas", force: :cascade do |t|
t.integer "region_id", limit: 4, default: 0, null: false
t.string "department", limit: 255
t.string "department", limit: 4, default: "0", null: false
t.string "name", limit: 255, default: "", null: false
t.string "url", limit: 255, default: "", null: false
t.string "city", limit: 255, default: "", null: false
@ -109,30 +109,52 @@ ActiveRecord::Schema.define(version: 20160103141244) do
t.string "feed", limit: 255
t.string "contact", limit: 255
t.string "submitter", limit: 255
t.boolean "moderated", default: false
t.boolean "moderated", limit: 1, default: false
t.datetime "submission_time"
t.datetime "decision_time"
t.string "secret", limit: 255
t.boolean "deleted", default: false, null: false
t.boolean "deleted", limit: 1, default: false, null: false
t.boolean "active", default: true, null: false
t.text "description", limit: 65535
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.string "tags", limit: 255, default: ""
t.text "tag"
t.text "tags", default: ""
t.text "diaspora"
end
add_index "orgas", ["kind_id"], name: "index_orgas_on_kind_id", using: :btree
add_index "orgas", ["kind_id"], name: "index_orgas_on_kind_id"
create_table "regions", force: :cascade do |t|
t.string "name", limit: 255, default: "", null: false
end
create_table "taggings", force: :cascade do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type", limit: 255
t.integer "tagger_id"
t.string "tagger_type", limit: 255
t.string "context", limit: 128
t.datetime "created_at"
end
add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
create_table "tags", force: :cascade do |t|
t.string "name", limit: 255
t.integer "taggings_count", default: 0
end
add_index "tags", ["name"], name: "index_tags_on_name", unique: true
create_table "translations", force: :cascade do |t|
t.string "locale", limit: 255
t.string "key", limit: 255
t.text "value", limit: 65535
t.text "interpolations", limit: 65535
t.boolean "is_proc", default: false
t.boolean "is_proc", limit: 1, default: false
end
create_table "users", force: :cascade do |t|
@ -144,14 +166,14 @@ ActiveRecord::Schema.define(version: 20160103141244) do
end
create_table "versions", force: :cascade do |t|
t.string "item_type", limit: 255, null: false
t.integer "item_id", limit: 4, null: false
t.string "event", limit: 255, null: false
t.string "whodunnit", limit: 255
t.text "object", limit: 65535
t.string "item_type", null: false
t.integer "item_id", null: false
t.string "event", null: false
t.string "whodunnit"
t.text "object"
t.datetime "created_at"
end
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
end