diff --git a/app/assets/javascripts/reports/new.js.erb b/app/assets/javascripts/reports/new.js.erb
index bec695d9a..d29903351 100644
--- a/app/assets/javascripts/reports/new.js.erb
+++ b/app/assets/javascripts/reports/new.js.erb
@@ -203,12 +203,6 @@ function initializeNewElement(newEl) {
url = dh.data("add-experiment-contents-url"); break;
case "my_module":
url = dh.data("add-module-contents-url"); break;
- case "step":
- url = dh.data("add-step-contents-url"); break;
- case "result_asset":
- case "result_table":
- case "result_text":
- url = dh.data("add-result-contents-url"); break;
}
}
diff --git a/app/assets/stylesheets/reports.scss b/app/assets/stylesheets/reports.scss
index b97332e3b..b4cf5fde8 100644
--- a/app/assets/stylesheets/reports.scss
+++ b/app/assets/stylesheets/reports.scss
@@ -46,9 +46,10 @@
// Modal for adding content
label {
- &[for="_module_content_all"],
- &[for="_step_content_all"],
- &[for="result_content_all"] {
+ &[for="_experiment_all"],
+ &[for="_module_all"],
+ &[for="_step_all"],
+ &[for="result_all"] {
font-weight: bold;
}
}
diff --git a/app/controllers/concerns/report_actions.rb b/app/controllers/concerns/report_actions.rb
index 6b0653738..c66e7ac13 100644
--- a/app/controllers/concerns/report_actions.rb
+++ b/app/controllers/concerns/report_actions.rb
@@ -70,8 +70,9 @@ module ReportActions
def generate_module_contents_json(my_module)
res = []
ReportExtends::MODULE_CONTENTS.each do |contents|
- protocol = contents.element == :step ? my_module.protocol.present? : true
- next unless in_params?("module_#{contents.element}".to_sym) && protocol
+ protocol = contents.element == :steps ? my_module.protocol.present? : true
+ next unless (in_params?("module_#{contents.element}".to_sym) ||
+ in_params?('#{contents.element}'.to_sym)) && protocol
if contents.children
contents.collection(my_module).each do |report_el|
res << generate_new_el(false)
@@ -82,9 +83,9 @@ module ReportActions
.singularize}_element.html.erb",
contents.parse_locals([report_el])
)
- if contents.locals.first == :step
+ if :step.in? contents.locals
el[:children] = generate_step_contents_json(report_el)
- elsif contents.locals.first == :result
+ elsif :result.in? contents.locals
el[:children] = generate_result_contents_json(report_el)
end
res << el
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index 9c33a4512..4b0c922b9 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -21,12 +21,8 @@ class ReportsController < ApplicationController
:project_contents_modal,
:experiment_contents_modal,
:module_contents_modal,
- :step_contents_modal,
- :result_contents_modal,
:project_contents,
- :module_contents,
- :step_contents,
- :result_contents
+ :module_contents
]
before_action :check_view_permissions, only: :index
@@ -40,12 +36,8 @@ class ReportsController < ApplicationController
:project_contents_modal,
:experiment_contents_modal,
:module_contents_modal,
- :step_contents_modal,
- :result_contents_modal,
:project_contents,
- :module_contents,
- :step_contents,
- :result_contents
+ :module_contents
]
before_action :check_destroy_permissions, only: :destroy
@@ -275,50 +267,6 @@ class ReportsController < ApplicationController
end
end
- # Modal for adding contents into step element
- def step_contents_modal
- step = Step.find_by_id(params[:id])
-
- respond_to do |format|
- if step.blank?
- format.json do
- render json: {}, status: :not_found
- end
- else
- format.json do
- render json: {
- html: render_to_string(
- partial: 'reports/new/modal/step_contents.html.erb',
- locals: { project: @project, step: step }
- )
- }
- end
- end
- end
- end
-
- # Modal for adding contents into result element
- def result_contents_modal
- result = Result.find_by_id(params[:id])
-
- respond_to do |format|
- if result.blank?
- format.json do
- render json: {}, status: :not_found
- end
- else
- format.json do
- render json: {
- html: render_to_string(
- partial: 'reports/new/modal/result_contents.html.erb',
- locals: { project: @project, result: result }
- )
- }
- end
- end
- end
- end
-
def project_contents
respond_to do |format|
elements = generate_project_contents_json
@@ -387,51 +335,6 @@ class ReportsController < ApplicationController
end
end
- def step_contents
- step = Step.find_by_id(params[:id])
-
- respond_to do |format|
- if step.blank?
- format.json { render json: {}, status: :not_found }
- else
- elements = generate_step_contents_json(step)
-
- if elements_empty? elements
- format.json { render json: {}, status: :no_content }
- else
- format.json {
- render json: {
- status: :ok,
- elements: elements
- }
- }
- end
- end
- end
- end
-
- def result_contents
- result = Result.find_by_id(params[:id])
- respond_to do |format|
- if result.blank?
- format.json { render json: {}, status: :not_found }
- else
- elements = generate_result_contents_json(result)
-
- if elements_empty? elements
- format.json { render json: {}, status: :no_content }
- else
- format.json {
- render json: {
- status: :ok,
- elements: elements
- }
- }
- end
- end
- end
- end
-
private
def load_vars
diff --git a/app/views/reports/new.html.erb b/app/views/reports/new.html.erb
index 41c43a58f..69eb41ced 100644
--- a/app/views/reports/new.html.erb
+++ b/app/views/reports/new.html.erb
@@ -13,8 +13,6 @@
data-add-project-contents-url="<%= project_contents_modal_project_reports_url %>"
data-add-experiment-contents-url="<%= experiment_contents_modal_project_reports_url %>"
data-add-module-contents-url="<%= module_contents_modal_project_reports_url %>"
- data-add-step-contents-url="<%= step_contents_modal_project_reports_url %>"
- data-add-result-contents-url="<%= result_contents_modal_project_reports_url %>"
data-stylesheet-url="<%= stylesheet_path "application" %>"
data-print-title="<%=t "projects.reports.print_title", project: @project.name %>"
data-project-id="<%= @project.id %>"
diff --git a/app/views/reports/new/modal/_experiment_contents_inner.html.erb b/app/views/reports/new/modal/_experiment_contents_inner.html.erb
index d3bca577f..2d9a32173 100644
--- a/app/views/reports/new/modal/_experiment_contents_inner.html.erb
+++ b/app/views/reports/new/modal/_experiment_contents_inner.html.erb
@@ -8,7 +8,7 @@
-
- <%= form.check_box :experiment_content_all, label: experiment.name %>
+ <%= form.check_box :experiment_all, label: experiment.name %>
<% experiment.my_module_groups.each do |my_module_group| %>
diff --git a/app/views/reports/new/modal/_module_contents_inner.html.erb b/app/views/reports/new/modal/_module_contents_inner.html.erb
index fd40d53c3..4b45ba393 100644
--- a/app/views/reports/new/modal/_module_contents_inner.html.erb
+++ b/app/views/reports/new/modal/_module_contents_inner.html.erb
@@ -9,7 +9,7 @@
-
- <%= form.check_box :module_content_all, label: t("projects.reports.elements.modals.module_contents_inner.check_all") %>
+ <%= form.check_box :module_all, label: t("projects.reports.elements.modals.module_contents_inner.check_all") %>
<% if my_module_undefined or my_module.protocol.steps.present? %>
diff --git a/app/views/reports/new/modal/_result_contents_inner.html.erb b/app/views/reports/new/modal/_result_contents_inner.html.erb
index d71992ec9..af31f4964 100644
--- a/app/views/reports/new/modal/_result_contents_inner.html.erb
+++ b/app/views/reports/new/modal/_result_contents_inner.html.erb
@@ -7,7 +7,7 @@
-
- <%= form.label :result_content_all, t("projects.reports.elements.modals.result_contents_inner.check_all"), class: "checkbox" %>
+ <%= form.label :result_all, t("projects.reports.elements.modals.result_contents_inner.check_all"), class: "checkbox" %>
-
diff --git a/app/views/reports/new/modal/_step_contents_inner.html.erb b/app/views/reports/new/modal/_step_contents_inner.html.erb
index 8e792f61f..c39c5992e 100644
--- a/app/views/reports/new/modal/_step_contents_inner.html.erb
+++ b/app/views/reports/new/modal/_step_contents_inner.html.erb
@@ -9,7 +9,7 @@
-
- <%= form.check_box :step_content_all, label: t("projects.reports.elements.modals.step_contents_inner.check_all") %>
+ <%= form.check_box :step_all, label: t("projects.reports.elements.modals.step_contents_inner.check_all") %>
<% if step_undefined or step.checklists.present? %>
diff --git a/db/schema.rb b/db/schema.rb
index a47b3aefc..c23af91a5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -70,6 +70,67 @@ ActiveRecord::Schema.define(version: 20170515073041) do
add_index "assets", ["last_modified_by_id"], name: "index_assets_on_last_modified_by_id", using: :btree
add_index "assets", ["team_id"], name: "index_assets_on_team_id", using: :btree
+ create_table "billing_accounts", force: :cascade do |t|
+ t.string "braintree_customer_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "billing_accounts", ["braintree_customer_id"], name: "index_billing_accounts_on_braintree_customer_id", using: :btree
+
+ create_table "billing_addons", force: :cascade do |t|
+ t.string "braintree_addon_id"
+ t.integer "type_of"
+ t.string "name", null: false
+ t.string "description"
+ t.integer "amount_cents", default: 0, null: false
+ t.string "amount_currency", default: "USD", null: false
+ t.integer "additional_storage", limit: 8, default: 0
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "billing_addons", ["braintree_addon_id"], name: "index_billing_addons_on_braintree_addon_id", using: :btree
+ add_index "billing_addons", ["name"], name: "index_billing_addons_on_name", using: :btree
+ add_index "billing_addons", ["type_of"], name: "index_billing_addons_on_type_of", using: :btree
+
+ create_table "billing_plans", force: :cascade do |t|
+ t.string "braintree_plan_id", null: false
+ t.string "name", null: false
+ t.string "description"
+ t.integer "price_cents", default: 0, null: false
+ t.string "price_currency", default: "USD", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.boolean "main", default: false, null: false
+ t.integer "max_storage", limit: 8, default: 0
+ t.integer "position", default: 0, null: false
+ t.boolean "free", default: false, null: false
+ end
+
+ add_index "billing_plans", ["braintree_plan_id"], name: "index_billing_plans_on_braintree_plan_id", using: :btree
+
+ create_table "billing_subscription_addons", force: :cascade do |t|
+ t.integer "billing_subscription_id", null: false
+ t.integer "billing_addon_id", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "billing_subscription_addons", ["billing_addon_id"], name: "index_billing_subscription_addons_on_billing_addon_id", using: :btree
+ add_index "billing_subscription_addons", ["billing_subscription_id"], name: "index_billing_subscription_addons_on_billing_subscription_id", using: :btree
+
+ create_table "billing_subscriptions", force: :cascade do |t|
+ t.string "braintree_subscription_id"
+ t.integer "billing_account_id", null: false
+ t.integer "billing_plan_id", null: false
+ t.boolean "active", default: false, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "billing_subscriptions", ["braintree_subscription_id"], name: "index_billing_subscriptions_on_braintree_subscription_id", using: :btree
+
create_table "checklist_items", force: :cascade do |t|
t.string "text", null: false
t.boolean "checked", default: false, null: false
@@ -175,6 +236,16 @@ ActiveRecord::Schema.define(version: 20170515073041) do
add_index "experiments", ["project_id"], name: "index_experiments_on_project_id", using: :btree
add_index "experiments", ["restored_by_id"], name: "index_experiments_on_restored_by_id", using: :btree
+ create_table "logs", force: :cascade do |t|
+ t.integer "action_type", null: false
+ t.string "user_name"
+ t.jsonb "details", default: {}, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "logs", ["created_at", "action_type"], name: "index_logs_on_created_at_and_action_type", using: :btree
+
create_table "my_module_groups", force: :cascade do |t|
t.string "name", null: false
t.datetime "created_at", null: false
@@ -197,26 +268,28 @@ ActiveRecord::Schema.define(version: 20170515073041) do
add_index "my_module_tags", ["tag_id"], name: "index_my_module_tags_on_tag_id", using: :btree
create_table "my_modules", force: :cascade do |t|
- t.string "name", null: false
+ t.string "name", null: false
t.datetime "due_date"
t.string "description"
- t.integer "x", default: 0, null: false
- t.integer "y", default: 0, null: false
+ t.integer "x", default: 0, null: false
+ t.integer "y", default: 0, null: false
t.integer "my_module_group_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.boolean "archived", default: false, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.boolean "archived", default: false, null: false
t.datetime "archived_on"
t.integer "created_by_id"
t.integer "last_modified_by_id"
t.integer "archived_by_id"
t.integer "restored_by_id"
t.datetime "restored_on"
- t.integer "nr_of_assigned_samples", default: 0
- t.integer "workflow_order", default: -1, null: false
- t.integer "experiment_id", default: 0, null: false
- t.integer "state", limit: 2, default: 0
+ t.integer "nr_of_assigned_samples", default: 0
+ t.integer "workflow_order", default: -1, null: false
+ t.integer "experiment_id", default: 0, null: false
+ t.integer "state", limit: 2, default: 0
t.datetime "completed_on"
+ t.integer "electronic_signature_status", default: 1
+ t.datetime "electronic_signature_status_locked_at"
end
add_index "my_modules", ["archived_by_id"], name: "index_my_modules_on_archived_by_id", using: :btree
@@ -468,6 +541,37 @@ ActiveRecord::Schema.define(version: 20170515073041) do
add_index "samples_tables", ["team_id"], name: "index_samples_tables_on_team_id", using: :btree
add_index "samples_tables", ["user_id"], name: "index_samples_tables_on_user_id", using: :btree
+ create_table "scinote_core_gamification_scores", force: :cascade do |t|
+ t.integer "leaf_tokens", limit: 8
+ t.integer "step", default: 0, null: false
+ t.integer "user_id"
+ t.boolean "tutorial", default: false
+ t.boolean "project", default: false
+ t.boolean "experiment", default: false
+ t.boolean "task", default: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "scinote_core_gamification_scores", ["user_id"], name: "index_scinote_core_gamification_scores_on_user_id", using: :btree
+
+ create_table "scinote_enterprise_electronic_signatures", force: :cascade do |t|
+ t.integer "user_id"
+ t.string "user_full_name", null: false
+ t.string "user_role", null: false
+ t.string "user_email", null: false
+ t.text "comment"
+ t.integer "action"
+ t.integer "type_of_signature"
+ t.integer "reference_object_id"
+ t.integer "reference_object_name"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "scinote_enterprise_electronic_signatures", ["created_at"], name: "index_scinote_enterprise_electronic_signatures_on_created_at", using: :btree
+ add_index "scinote_enterprise_electronic_signatures", ["user_id"], name: "index_scinote_enterprise_electronic_signatures_on_user_id", using: :btree
+
create_table "settings", force: :cascade do |t|
t.text "type", null: false
t.jsonb "values", default: {}, null: false
@@ -547,8 +651,11 @@ ActiveRecord::Schema.define(version: 20170515073041) do
t.integer "last_modified_by_id"
t.string "description"
t.integer "space_taken", limit: 8, default: 1048576, null: false
+ t.integer "billing_account_id"
+ t.integer "agile_crm_deal_id", limit: 8
end
+ add_index "teams", ["billing_account_id"], name: "index_teams_on_billing_account_id", using: :btree
add_index "teams", ["created_by_id"], name: "index_teams_on_created_by_id", using: :btree
add_index "teams", ["last_modified_by_id"], name: "index_teams_on_last_modified_by_id", using: :btree
add_index "teams", ["name"], name: "index_teams_on_name", using: :btree
@@ -669,6 +776,8 @@ ActiveRecord::Schema.define(version: 20170515073041) do
t.string "invited_by_type"
t.integer "invitations_count", default: 0
t.integer "tutorial_status", default: 0, null: false
+ t.datetime "last_seen_at"
+ t.integer "agile_crm_contact_id", limit: 8
t.boolean "assignments_notification", default: true
t.boolean "recent_notification", default: true
t.boolean "assignments_notification_email", default: false
@@ -676,6 +785,8 @@ ActiveRecord::Schema.define(version: 20170515073041) do
t.integer "current_team_id"
t.boolean "system_message_notification_email", default: false
t.string "authentication_token", limit: 30
+ t.integer "organization_role", limit: 2, default: 0
+ t.datetime "password_changed_at"
end
add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree
@@ -684,8 +795,22 @@ ActiveRecord::Schema.define(version: 20170515073041) do
add_index "users", ["invitation_token"], name: "index_users_on_invitation_token", unique: true, using: :btree
add_index "users", ["invitations_count"], name: "index_users_on_invitations_count", using: :btree
add_index "users", ["invited_by_id"], name: "index_users_on_invited_by_id", using: :btree
+ add_index "users", ["password_changed_at"], name: "index_users_on_password_changed_at", using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
+ create_table "versions", force: :cascade do |t|
+ t.string "item_type", null: false
+ t.integer "item_id", null: false
+ t.string "event", null: false
+ t.string "whodunnit"
+ t.text "object"
+ t.text "object_changes"
+ t.integer "team_id"
+ t.datetime "created_at"
+ end
+
+ add_index "versions", ["item_type", "item_id", "team_id"], name: "index_versions_on_item_type_and_item_id_and_team_id", using: :btree
+
create_table "wopi_actions", force: :cascade do |t|
t.string "action", null: false
t.string "extension", null: false
@@ -728,6 +853,10 @@ ActiveRecord::Schema.define(version: 20170515073041) do
add_foreign_key "asset_text_data", "assets"
add_foreign_key "assets", "users", column: "created_by_id"
add_foreign_key "assets", "users", column: "last_modified_by_id"
+ add_foreign_key "billing_subscription_addons", "billing_addons"
+ add_foreign_key "billing_subscription_addons", "billing_subscriptions"
+ add_foreign_key "billing_subscriptions", "billing_accounts"
+ add_foreign_key "billing_subscriptions", "billing_plans"
add_foreign_key "checklist_items", "checklists"
add_foreign_key "checklist_items", "users", column: "created_by_id"
add_foreign_key "checklist_items", "users", column: "last_modified_by_id"
@@ -807,6 +936,7 @@ ActiveRecord::Schema.define(version: 20170515073041) do
add_foreign_key "samples", "teams"
add_foreign_key "samples", "users"
add_foreign_key "samples", "users", column: "last_modified_by_id"
+ add_foreign_key "scinote_core_gamification_scores", "users"
add_foreign_key "step_assets", "assets"
add_foreign_key "step_assets", "steps"
add_foreign_key "step_tables", "steps"
@@ -819,6 +949,7 @@ ActiveRecord::Schema.define(version: 20170515073041) do
add_foreign_key "tags", "projects"
add_foreign_key "tags", "users", column: "created_by_id"
add_foreign_key "tags", "users", column: "last_modified_by_id"
+ add_foreign_key "teams", "billing_accounts"
add_foreign_key "teams", "users", column: "created_by_id"
add_foreign_key "teams", "users", column: "last_modified_by_id"
add_foreign_key "tokens", "users"