Merge pull request #314 from ZmagoD/zd_SCI_643

adds autolink
This commit is contained in:
Zmago Devetak 2016-12-05 10:47:23 +01:00 committed by GitHub
commit 91f29745c4
20 changed files with 74 additions and 30 deletions

View file

@ -54,6 +54,7 @@ gem 'auto_strip_attributes', '~> 2.1' # Removes unnecessary whitespaces from Act
gem 'deface', '~> 1.0' gem 'deface', '~> 1.0'
gem 'nokogiri' # HTML/XML parser gem 'nokogiri' # HTML/XML parser
gem 'sneaky-save', git: 'git://github.com/einzige/sneaky-save.git' gem 'sneaky-save', git: 'git://github.com/einzige/sneaky-save.git'
gem 'rails_autolink', '~> 1.1', '>= 1.1.6'
gem 'paperclip', '~> 4.3' # File attachment, image attachment library gem 'paperclip', '~> 4.3' # File attachment, image attachment library
gem 'aws-sdk', '~> 2.2.8' gem 'aws-sdk', '~> 2.2.8'

View file

@ -234,6 +234,8 @@ GEM
rails_12factor (0.0.3) rails_12factor (0.0.3)
rails_serve_static_assets rails_serve_static_assets
rails_stdout_logging rails_stdout_logging
rails_autolink (1.1.6)
rails (> 3.1)
rails_serve_static_assets (0.0.4) rails_serve_static_assets (0.0.4)
rails_stdout_logging (0.0.4) rails_stdout_logging (0.0.4)
railties (4.2.5) railties (4.2.5)
@ -376,6 +378,7 @@ DEPENDENCIES
quill-rails! quill-rails!
rails (= 4.2.5) rails (= 4.2.5)
rails_12factor rails_12factor
rails_autolink (~> 1.1, >= 1.1.6)
remotipart (~> 1.2) remotipart (~> 1.2)
rgl rgl
roo (~> 2.1.0) roo (~> 2.1.0)

View file

@ -425,13 +425,12 @@ li.module-hover {
} }
.experiment-description { .experiment-description {
display: flex; border: 1px solid $color-alto;
flex: 1 1 auto; border-radius: 4px;
height: 100px;
margin-top: 10px; margin-top: 10px;
overflow-y: overlay;
textarea { padding: 10px;
resize: none;
}
} }
.experiment-no-description { .experiment-no-description {

View file

@ -1,6 +1,7 @@
require 'active_record' require 'active_record'
class SampleDatatable < AjaxDatatablesRails::Base class SampleDatatable < AjaxDatatablesRails::Base
include ActionView::Helpers::TextHelper
include SamplesHelper include SamplesHelper
ASSIGNED_SORT_COL = "assigned" ASSIGNED_SORT_COL = "assigned"
@ -90,7 +91,11 @@ class SampleDatatable < AjaxDatatablesRails::Base
# Add custom attributes # Add custom attributes
record.sample_custom_fields.each do |scf| record.sample_custom_fields.each do |scf|
sample[@cf_mappings[scf.custom_field_id]] = scf.value sample[@cf_mappings[scf.custom_field_id]] = auto_link(scf.value,
link: :urls,
html: {
target: '_blank'
})
end end
sample sample
end end

View file

@ -39,5 +39,7 @@
</div> </div>
<strong><%= comment.user.full_name %>:</strong> <strong><%= comment.user.full_name %>:</strong>
<div data-role="comment-message-container"> <div data-role="comment-message-container">
<p data-role="comment-message"><%= comment.message %></p> <p data-role="comment-message"><%= auto_link(simple_format(comment.message),
link: :urls,
html: { target: '_blank' }) %></p>
</div> </div>

View file

@ -1,5 +1,7 @@
<% if @my_module.description.blank? %> <% if @my_module.description.blank? %>
<em><%=t "experiments.canvas.popups.no_description" %></em> <em><%=t "experiments.canvas.popups.no_description" %></em>
<% else %> <% else %>
<%= @my_module.description %> <%= auto_link(simple_format(@my_module.description),
<% end %> link: :urls,
html: { target: '_blank' }) %>
<% end %>

View file

@ -95,4 +95,4 @@
<!-- Manage tags modal --> <!-- Manage tags modal -->
<%= render partial: "my_modules/modals/manage_module_tags_modal", locals: { my_module: @my_module } %> <%= render partial: "my_modules/modals/manage_module_tags_modal", locals: { my_module: @my_module } %>
<%= javascript_include_tag("my_modules") %> <%= javascript_include_tag("my_modules") %>

View file

@ -39,5 +39,7 @@
</div> </div>
<strong><%= comment.user.full_name %>:</strong> <strong><%= comment.user.full_name %>:</strong>
<div data-role="comment-message-container"> <div data-role="comment-message-container">
<p data-role="comment-message"><%= comment.message %></p> <p data-role="comment-message"><%= auto_link(simple_format(comment.message),
link: :urls,
html: { target: '_blank' }) %></p>
</div> </div>

View file

@ -48,9 +48,11 @@
<%= localize(experiment.created_at, format: t('time.formats.full_date')) %> - <%= localize(experiment.updated_at, format: t('time.formats.full_date')) %> <%= localize(experiment.created_at, format: t('time.formats.full_date')) %> - <%= localize(experiment.updated_at, format: t('time.formats.full_date')) %>
</span> </span>
<% if experiment.description? %> <% if experiment.description? %>
<span class='experiment-description'> <div class='experiment-description'>
<%= text_area :entry, :body, value: experiment.description, class: 'form-control', readonly: true %> <%= auto_link(simple_format(experiment.description),
</span> link: :urls,
html: { target: '_blank' }) %>
</div>
<% else %> <% else %>
<span class='experiment-no-description'> <span class='experiment-no-description'>
<% if can_edit_experiment(experiment) %> <% if can_edit_experiment(experiment) %>

View file

@ -27,7 +27,9 @@
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<% if experiment.description.present? %> <% if experiment.description.present? %>
<%= experiment.description %> <%= auto_link(simple_format(experiment.description),
link: :urls,
html: { target: '_blank' }) %>
<% else %> <% else %>
<em><%=t "projects.reports.elements.experiment.no_description" %></em> <em><%=t "projects.reports.elements.experiment.no_description" %></em>
<% end %> <% end %>

View file

@ -30,7 +30,9 @@
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<% if my_module.description.present? %> <% if my_module.description.present? %>
<%= my_module.description %> <%= auto_link(simple_format(my_module.description),
link: :urls,
html: { target: '_blank' }) %>
<% else %> <% else %>
<em><%=t "projects.reports.elements.module.no_description" %></em> <em><%=t "projects.reports.elements.module.no_description" %></em>
<% end %> <% end %>

View file

@ -31,7 +31,9 @@
</span> </span>
<span class="comment-message"> <span class="comment-message">
&nbsp; &nbsp;
<%= comment.message %> <%= auto_link(simple_format(comment.message),
link: :urls,
html: { target: '_blank' }) %>
</span> </span>
</li> </li>
<% end %> <% end %>

View file

@ -23,7 +23,9 @@
<div class="report-element-body"> <div class="report-element-body">
<div class="row"> <div class="row">
<div class="col-xs-12 text-container ql-editor"> <div class="col-xs-12 text-container ql-editor">
<%= result_text.text.html_safe %> <%= auto_link(result_text.text,
link: :urls,
html: { target: '_blank' }).html_safe %>
</div> </div>
</div> </div>
</div> </div>

View file

@ -23,7 +23,11 @@
<% items.each do |item| %> <% items.each do |item| %>
<li> <li>
<input type="checkbox" disabled="disabled" <%= "checked='checked'" if item.checked %>/> <input type="checkbox" disabled="disabled" <%= "checked='checked'" if item.checked %>/>
<span class="<%= 'checked' if item.checked %>"><%= item.text %></span> <span class="<%= 'checked' if item.checked %>">
<%= auto_link(simple_format(item.text),
link: :urls,
html: { target: '_blank' }) %></span>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View file

@ -31,7 +31,9 @@
</span> </span>
<span class="comment-message"> <span class="comment-message">
&nbsp; &nbsp;
<%= comment.message %> <%= auto_link(simple_format(comment.message),
link: :urls,
html: { target: '_blank' }) %>
</span> </span>
</li> </li>
<% end %> <% end %>

View file

@ -27,7 +27,9 @@
<div class="row"> <div class="row">
<div class="col-xs-12 ql-editor"> <div class="col-xs-12 ql-editor">
<% if strip_tags(step.description).present? %> <% if strip_tags(step.description).present? %>
<%= step.description.html_safe %> <%= auto_link(step.description,
link: :urls,
html: { target: '_blank' }).html_safe %>
<% else %> <% else %>
<em><%=t "projects.reports.elements.step.no_description" %></em> <em><%=t "projects.reports.elements.step.no_description" %></em>
<% end %> <% end %>

View file

@ -40,5 +40,7 @@
<% end %> <% end %>
</div> </div>
<div data-role="comment-message-container"> <div data-role="comment-message-container">
<p data-role="comment-message"><%= comment.message %></p> <p data-role="comment-message"><%= auto_link(simple_format(comment.message),
</div> link: :urls,
html: { target: '_blank' }) %></p>
</div>

View file

@ -1,3 +1,5 @@
<div class="ql-editor"> <div class="ql-editor">
<%= result.result_text.text.html_safe %> <%= auto_link(result.result_text.text,
link: :urls,
html: { target: '_blank' }).html_safe %>
</div> </div>

View file

@ -40,5 +40,7 @@
<% end %> <% end %>
</div> </div>
<div data-role="comment-message-container"> <div data-role="comment-message-container">
<p data-role="comment-message"><%= comment.message %></p> <p data-role="comment-message"><%= auto_link(simple_format(comment.message),
</div> link: :urls,
html: { target: '_blank' }) %></p>
</div>

View file

@ -37,7 +37,9 @@
<em><%= t("protocols.steps.no_description") %></em> <em><%= t("protocols.steps.no_description") %></em>
<% else %> <% else %>
<div class="ql-editor"> <div class="ql-editor">
<%= step.description.html_safe %> <%= auto_link(step.description,
link: :urls,
html: { target: '_blank' }).html_safe %>
</div> </div>
<% end %> <% end %>
</div> </div>
@ -86,7 +88,9 @@
<% unless step.checklists.blank? then %> <% unless step.checklists.blank? then %>
<div class="col-xs-12"> <div class="col-xs-12">
<% step.checklists.each do |checklist| %> <% step.checklists.each do |checklist| %>
<strong><%= checklist.name %></strong> <strong><%= auto_link(simple_format(checklist.name),
link: :urls,
html: { target: '_blank' }) %></strong>
<% if checklist.checklist_items.empty? %> <% if checklist.checklist_items.empty? %>
</br> </br>
<%= t("protocols.steps.empty_checklist") %> <%= t("protocols.steps.empty_checklist") %>
@ -100,7 +104,9 @@
<% else %> <% else %>
<input type="checkbox" value="" disabled="disabled" /> <input type="checkbox" value="" disabled="disabled" />
<% end %> <% end %>
<%= checklist_item.text %> <%= auto_link(simple_format(checklist_item.text),
link: :urls,
html: { target: '_blank' }) %>
</label> </label>
</div> </div>
<% end %> <% end %>