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 'nokogiri' # HTML/XML parser
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 'aws-sdk', '~> 2.2.8'

View file

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

View file

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

View file

@ -1,6 +1,7 @@
require 'active_record'
class SampleDatatable < AjaxDatatablesRails::Base
include ActionView::Helpers::TextHelper
include SamplesHelper
ASSIGNED_SORT_COL = "assigned"
@ -90,7 +91,11 @@ class SampleDatatable < AjaxDatatablesRails::Base
# Add custom attributes
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
sample
end

View file

@ -39,5 +39,7 @@
</div>
<strong><%= comment.user.full_name %>:</strong>
<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>

View file

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

View file

@ -95,4 +95,4 @@
<!-- Manage tags modal -->
<%= 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>
<strong><%= comment.user.full_name %>:</strong>
<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>

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')) %>
</span>
<% if experiment.description? %>
<span class='experiment-description'>
<%= text_area :entry, :body, value: experiment.description, class: 'form-control', readonly: true %>
</span>
<div class='experiment-description'>
<%= auto_link(simple_format(experiment.description),
link: :urls,
html: { target: '_blank' }) %>
</div>
<% else %>
<span class='experiment-no-description'>
<% if can_edit_experiment(experiment) %>

View file

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

View file

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

View file

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

View file

@ -23,7 +23,9 @@
<div class="report-element-body">
<div class="row">
<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>

View file

@ -23,7 +23,11 @@
<% items.each do |item| %>
<li>
<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>
<% end %>
</ul>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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