diff --git a/app/assets/stylesheets/admin.css.less b/app/assets/stylesheets/admin.css.less
index 48be624..05664c9 100644
--- a/app/assets/stylesheets/admin.css.less
+++ b/app/assets/stylesheets/admin.css.less
@@ -1164,6 +1164,9 @@
padding:0 2px 10px 0;
}
+td.organisation-logo {
+ padding: 0 25px 10px 25px;
+}
table.dmp_details_table {
margin: 0 0 0 0;
diff --git a/app/models/organisation.rb b/app/models/organisation.rb
index 4c0f282..caccda5 100644
--- a/app/models/organisation.rb
+++ b/app/models/organisation.rb
@@ -1,6 +1,8 @@
+#require 'validators/email_validator'
+
class Organisation < ActiveRecord::Base
include GlobalHelpers
-
+
extend Dragonfly::Model::Validations
#associations between tables
@@ -21,14 +23,15 @@
has_many :children, :class_name => 'Organisation', :foreign_key => 'parent_id'
-# accepts_nested_attributes_for :organisation_type
accepts_nested_attributes_for :dmptemplates
accepts_nested_attributes_for :token_permission_types
- attr_accessible :abbreviation, :banner_text, :logo, :remove_logo, :description, :domain,
+ attr_accessible :abbreviation, :banner_text, :logo, :remove_logo, :domain,
:logo_file_name, :name, :stylesheet_file_id, :target_url,
:organisation_type_id, :wayfless_entity, :parent_id, :sort_name,
- :token_permission_type_ids, :language_id
+ :token_permission_type_ids, :language_id, :contact_email
+
+ validates :contact_email, email: true
# allow validations for logo upload
dragonfly_accessor :logo do
diff --git a/app/validators/email_validator.rb b/app/validators/email_validator.rb
new file mode 100644
index 0000000..d47e7c1
--- /dev/null
+++ b/app/validators/email_validator.rb
@@ -0,0 +1,7 @@
+class EmailValidator < ActiveModel::EachValidator
+ def validate_each(record, attribute, value)
+ unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
+ record.errors[attribute] << (options[:message] || "is not a valid email address")
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/views/organisations/admin_edit.html.erb b/app/views/organisations/admin_edit.html.erb
index 37ed08f..8da93e8 100644
--- a/app/views/organisations/admin_edit.html.erb
+++ b/app/views/organisations/admin_edit.html.erb
@@ -49,12 +49,7 @@
|
-
- | <%= t('org_admin.org_desc') %> |
- <%= f.text_area :description, {
- :rows => 5,
- :class => 'text_area has-tooltip', 'data-toggle' => "tooltip", 'data-html' => "true", 'title'=> t('org_admin.desc_help_text_html')} %> |
-
+
| <%= t('org_admin.org_banner_text') %> |
@@ -67,6 +62,14 @@
:as => :string,
:class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('org_admin.target_url_help_text') %> |
+
+
+ | <%= t('org_admin.org_contact_email') %> |
+ <%= f.text_field :contact_email,
+ :as => :string,
+ :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('org_admin.org_contact_email_help_text') %> |
+
+
| <%= t('org_admin.org_type') %> |
<%= @organisation.organisation_type.name %> |
diff --git a/app/views/organisations/admin_show.html.erb b/app/views/organisations/admin_show.html.erb
index c412b82..91ac5ee 100644
--- a/app/views/organisations/admin_show.html.erb
+++ b/app/views/organisations/admin_show.html.erb
@@ -6,7 +6,7 @@
<%= t('org_admin.org_text')%>
-
@@ -19,6 +19,10 @@
| <%= t('org_admin.org_name') %> |
<%= @organisation.name %> |
+
+ <% if @organisation.logo.present? then%>
+ <%= image_tag @organisation.logo.thumb('100x100%').url %> |
+ <%end%>
<%end%>
<% if @organisation.abbreviation.present? then%>
@@ -27,19 +31,7 @@
<%= @organisation.abbreviation %> |
<%end%>
- <% if @organisation.logo.present? then%>
-
- | <%= t('org_admin.org_logo') %> |
- <%= image_tag @organisation.logo.thumb('100x100%').url %> |
-
- <%end%>
- <% if @organisation.description.present? then%>
-
- | <%= t('org_admin.org_desc') %> |
- <%= raw @organisation.description %> |
-
- <%end%>
- <% if @organisation.banner_text.present? then%>
+ <% if @organisation.banner_text.present? then%>
| <%= t('org_admin.org_banner_text') %> |
<%= raw @organisation.banner_text %> |
@@ -51,6 +43,12 @@
<%= @organisation.target_url %> |
<%end%>
+ <% if @organisation.contact_email.present? then%>
+
+ | <%= t('org_admin.org_contact_email') %> |
+ <%= @organisation.contact_email %> |
+
+ <%end%>
<% if @organisation.organisation_type_id.present? then%>
| <%= t('org_admin.org_type') %> |
@@ -68,13 +66,14 @@
<%= l @organisation.updated_at.to_date, :formats => :short %> |
-
-
-
+
+
+
+
<%= link_to t("helpers.submit.edit"), admin_edit_organisation_path(current_user.organisation), :class => 'btn btn-primary'%>
->>>>>>> d191694e1cedc43d310c37ca7ceae733e677fb03
+
diff --git a/config/locales/de.yml b/config/locales/de.yml
index b02b379..4ff6706 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -109,6 +109,8 @@
org_abbr: "Abkürzung"
org_logo_failed_message: "Logo Upload fehlgeschlagen."
org_logo: "Logo"
+ org_contact_email: "Kontakt Email"
+ org_contact_email_help_text: "Die E-Mail -Adresse des Administrators in Ihrer Organisation. Ihre Benutzer werden diese Adresse verwenden, wenn sie Fragen haben."
new_org_logo: "Laden Sie ein neues Logo-Datei"
remove_logo: "Wenn Sie die Standard DMPRoadmap Logo verwenden entscheiden , prüfen Sie bitte dieses Feld Ihre aktuelle Logo zu entfernen."
org_desc: "Beschreibung"
diff --git a/config/locales/en-UK.yml b/config/locales/en-UK.yml
index 92afa49..c930f82 100644
--- a/config/locales/en-UK.yml
+++ b/config/locales/en-UK.yml
@@ -141,6 +141,8 @@
org_details_label: "Organisation details"
org_text: "These are the basic details for your organisation."
org_abbr_help_text_html: "This is what displays as a label on your guidance, e.g. 'Glasgow guidance on Metadata'. It's best to use an abbreviation or short name."
+ org_contact_email: "Contact Email"
+ org_contact_email_help_text: "The email address of an administrator at your organisation. Your users will use this address if they have questions."
users_list: "List of users"
user_full_name: "Name"
user_name: "Email address"
diff --git a/config/locales/en-US.yml b/config/locales/en-US.yml
index f6af71a..8f7d952 100644
--- a/config/locales/en-US.yml
+++ b/config/locales/en-US.yml
@@ -143,6 +143,8 @@
org_abbr: "Abbreviation"
org_logo_failed_message: "Logo Upload Failed."
org_logo: "Logo"
+ org_contact_email: "Contact Email"
+ org_contact_email_help_text: "The email address of an administrator at your organization. Your users will use this address if they have questions."
new_org_logo: "Upload a new logo file"
remove_logo: "If you decide to use the default DMPRoadmap logo, please check this box to remove your current logo."
org_desc: "Description"
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 08c60f8..4b6f19e 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -116,6 +116,8 @@
org_abbr: "Abréviation"
org_logo_failed_message: "Logo Échec de l'envoi."
org_logo: "Logo"
+ org_contact_email: "Contact Email"
+ org_contact_email_help_text: "L' adresse e-mail d'un administrateur dans votre organisation. Vos utilisateurs utiliseront cette adresse si elles ont des questions."
new_org_logo: "Ajouter un nouveau fichier de logo"
remove_logo: "Si vous décidez d'utiliser le logo de DMPRoadmap par défaut , s'il vous plaît cocher cette case pour supprimer votre logo actuel."
org_desc: "Description"
diff --git a/db/migrate/20160822130601_remove_description_from_organisation.rb b/db/migrate/20160822130601_remove_description_from_organisation.rb
new file mode 100644
index 0000000..0761ad5
--- /dev/null
+++ b/db/migrate/20160822130601_remove_description_from_organisation.rb
@@ -0,0 +1,5 @@
+class RemoveDescriptionFromOrganisation < ActiveRecord::Migration
+ def change
+ remove_column :organisations, :description
+ end
+end
diff --git a/db/migrate/20160822130701_add_contact_email_to_organisation.rb b/db/migrate/20160822130701_add_contact_email_to_organisation.rb
new file mode 100644
index 0000000..ae7cb3c
--- /dev/null
+++ b/db/migrate/20160822130701_add_contact_email_to_organisation.rb
@@ -0,0 +1,5 @@
+class AddContactEmailToOrganisation < ActiveRecord::Migration
+ def change
+ add_column :organisations, :contact_email, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 44466b9..c14f575 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,9 @@
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20160810193149) do
+
+ActiveRecord::Schema.define(version: 20160822130701) do
+
create_table "answers", force: :cascade do |t|
t.text "text", limit: 65535
t.integer "plan_id", limit: 4
@@ -31,8 +33,8 @@
t.integer "user_id", limit: 4
t.integer "question_id", limit: 4
t.text "text", limit: 65535
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.boolean "archived"
t.integer "plan_id", limit: 4
t.integer "archived_by", limit: 4
@@ -85,7 +87,7 @@
end
create_table "friendly_id_slugs", force: :cascade do |t|
- t.string "slug", limit: 191, null: false
+ t.string "slug", limit: 255, null: false
t.integer "sluggable_id", limit: 4, null: false
t.string "sluggable_type", limit: 40
t.datetime "created_at"
@@ -98,8 +100,8 @@
create_table "guidance_groups", force: :cascade do |t|
t.string "name", limit: 255
t.integer "organisation_id", limit: 4
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.boolean "optional_subset"
t.boolean "published"
end
@@ -140,8 +142,8 @@
t.string "text", limit: 255
t.integer "number", limit: 4
t.boolean "is_default"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
end
create_table "org_token_permissions", force: :cascade do |t|
@@ -161,7 +163,6 @@
create_table "organisations", force: :cascade do |t|
t.string "name", limit: 255
t.string "abbreviation", limit: 255
- t.text "description", limit: 65535
t.string "target_url", limit: 255
t.integer "organisation_type_id", limit: 4
t.string "domain", limit: 255
@@ -178,6 +179,7 @@
t.integer "language_id", limit: 4
t.string "logo_uid", limit: 255
t.string "logo_name", limit: 255
+ t.string "contact_email", limit: 255
end
create_table "phases", force: :cascade do |t|
@@ -185,9 +187,9 @@
t.text "description", limit: 65535
t.integer "number", limit: 4
t.integer "dmptemplate_id", limit: 4
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "slug", limit: 191
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.string "slug", limit: 255
end
add_index "phases", ["dmptemplate_id"], name: "index_phases_on_dmptemplate_id", using: :btree
@@ -215,8 +217,8 @@
t.boolean "project_editor"
t.integer "user_id", limit: 4
t.integer "project_id", limit: 4
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.boolean "project_administrator"
end
@@ -230,9 +232,9 @@
create_table "projects", force: :cascade do |t|
t.string "title", limit: 255
t.integer "dmptemplate_id", limit: 4
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "slug", limit: 191
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.string "slug", limit: 255
t.integer "organisation_id", limit: 4
t.string "grant_number", limit: 255
t.string "identifier", limit: 255
@@ -286,9 +288,9 @@
end
create_table "roles", force: :cascade do |t|
- t.string "name", limit: 191
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.string "name", limit: 255
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.boolean "role_in_plans"
t.integer "resource_id", limit: 4
t.string "resource_type", limit: 255
@@ -303,18 +305,18 @@
t.integer "number", limit: 4
t.integer "version_id", limit: 4
t.integer "organisation_id", limit: 4
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.boolean "published"
end
create_table "settings", force: :cascade do |t|
- t.string "var", limit: 191, null: false
+ t.string "var", limit: 255, null: false
t.text "value", limit: 65535
t.integer "target_id", limit: 4, null: false
- t.string "target_type", limit: 191, null: false
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.string "target_type", limit: 255, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
end
add_index "settings", ["target_type", "target_id", "var"], name: "index_settings_on_target_type_and_target_id_and_var", unique: true, using: :btree
@@ -329,8 +331,8 @@
t.integer "question_id", limit: 4
t.integer "organisation_id", limit: 4
t.text "text", limit: 65535
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.boolean "is_example"
end
@@ -386,7 +388,7 @@
create_table "users", force: :cascade do |t|
t.string "firstname", limit: 255
t.string "surname", limit: 255
- t.string "email", limit: 191, default: "", null: false
+ t.string "email", limit: 255, default: "", null: false
t.string "orcid_id", limit: 255
t.string "shibboleth_id", limit: 255
t.integer "user_type_id", limit: 4
@@ -394,7 +396,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "encrypted_password", limit: 255, default: ""
- t.string "reset_password_token", limit: 191
+ t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", limit: 4, default: 0
@@ -402,15 +404,14 @@
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
- t.string "confirmation_token", limit: 191
+ t.string "confirmation_token", limit: 255
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
- t.string "invitation_token", limit: 191
+ t.string "invitation_token", limit: 255
t.datetime "invitation_created_at"
t.datetime "invitation_sent_at"
t.datetime "invitation_accepted_at"
t.string "other_organisation", limit: 255
- t.boolean "dmponline3"
t.boolean "accept_terms"
t.integer "organisation_id", limit: 4
t.string "api_token", limit: 255