Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SJ IE - Adding blue highlight when document is added #412

Merged
merged 1 commit into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/assets/stylesheets/application.sass
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
@import "protocols"
@import "participants"
@import "tasks"
@import "notes"
@import "notifications"
@import "study_schedule"
@import "study_level_activities"
Expand Down Expand Up @@ -171,11 +170,11 @@ div.tooltip-inner
.glyphicon.disabled
cursor: not-allowed

.disabled-billing
.disabled-billing
color: gray
cursor: not-allowed

.disabled-status
.disabled-status
.active.disabled:hover
background-color: #e6e6e6
border-color: #adadad
Expand Down
22 changes: 0 additions & 22 deletions app/assets/stylesheets/notes.sass

This file was deleted.

3 changes: 3 additions & 0 deletions app/assets/stylesheets/study_level_activities.sass
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ td.wrap
div.modal-content
width: 60%
min-width: 1050px

.blue-glyphicon
color: blue
4 changes: 2 additions & 2 deletions app/controllers/documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def create
state: "Completed"))

create_document_file

@selector = "#{@document.unique_selector}_documents"
flash.now[:success] = t(:documents)[:flash_messages][:created]
}
end
Expand Down Expand Up @@ -101,7 +101,7 @@ def update

def destroy
respond_to do |format|
format.js {
format.js {
mark_document_as_accessed if @document.last_accessed_at.nil?
@document.destroy

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def logged_in identity

def notes_button params
content_tag(:button, class: "btn btn-default #{params[:button_class].nil? ? '' : params[:button_class]} list notes", title: params[:title], label: "Notes List", data: {notable_id: params[:object].id, notable_type: params[:object].class.name}, toggle: "tooltip", animation: 'false') do
content_tag(:span, '', id: "#{params[:object].class.name.downcase}_#{params[:object].id}_notes", class: "glyphicon glyphicon-list-alt #{params[:span_class].nil? ? "" : params[:span_class]} #{params[:has_notes] ? "blue-notes" : ""}")
content_tag(:span, '', id: "#{params[:object].class.name.downcase}_#{params[:object].id}_notes", class: "glyphicon glyphicon-list-alt #{params[:has_notes] ? "blue-glyphicon" : ""}")
end
end

Expand Down
16 changes: 11 additions & 5 deletions app/helpers/study_level_activities_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def sla_components_select line_item_id, components
def sla_options_buttons line_item
options = raw(
note_list_item({object: line_item, has_notes: line_item.notes.any?})+
content_tag(:li, raw(
content_tag(:button, raw(content_tag(:span, '', class: "glyphicon glyphicon-open-file", aria: {hidden: "true"}))+' Documents', type: 'button', class: 'btn btn-default form-control actions-button documents list', data: {documentable_id: line_item.id, documentable_type: "LineItem"}))
)+
document_list_item({object: line_item, has_documents: line_item.documents.any?})+
content_tag(:li, raw(
content_tag(:button, raw(content_tag(:span, '', class: "glyphicon glyphicon-edit", aria: {hidden: "true"}))+' Edit Activity', type: 'button', class: 'btn btn-default form-control actions-button otf_edit'))
)+
Expand Down Expand Up @@ -119,8 +117,16 @@ def fulfillment_date_formatter fulfillment
def note_list_item params
content_tag(:li, raw(
content_tag(:button,
raw(content_tag(:span, '', id: "#{params[:object].class.name.downcase}_#{params[:object].id}_notes", class: "glyphicon glyphicon-list-alt #{params[:span_class].nil? ? '' : params[:span_class]} #{params[:has_notes] ? 'blue-notes' : ''}", aria: {hidden: "true"}))+
' Notes', type: 'button', class: "btn btn-default #{params[:button_class].nil? ? '' : params[:button_class]} form-control actions-button notes list", data: {notable_id: params[:object].id, notable_type: params[:object].class.name}))
raw(content_tag(:span, '', id: "#{params[:object].class.name.downcase}_#{params[:object].id}_notes", class: "glyphicon glyphicon-list-alt #{params[:has_notes] ? 'blue-glyphicon' : ''}", aria: {hidden: "true"}))+
' Notes', type: 'button', class: "btn btn-default form-control actions-button notes list", data: {notable_id: params[:object].id, notable_type: params[:object].class.name}))
)
end

def document_list_item params
content_tag(:li, raw(
content_tag(:button,
raw(content_tag(:span, '', id: "#{params[:object].class.name.downcase}_#{params[:object].id}_documents", class: "glyphicon glyphicon-open-file #{params[:has_documents] ? 'blue-glyphicon' : ''}", aria: {hidden: "true"}))+
' Documents', type: 'button', class: "btn btn-default form-control actions-button documents list", data: {documentable_id: params[:object].id, documentable_type: params[:object].class.name}))
)
end
end
8 changes: 6 additions & 2 deletions app/models/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Document < ApplicationRecord
belongs_to :documentable, polymorphic: true

validates :title, presence: true

def path
[ENV.fetch('DOCUMENTS_FOLDER'), id].join('/')
end
Expand All @@ -41,8 +41,12 @@ def failed?
def downloaded?
last_accessed_at
end

def accessible_by?(identity)
!(documentable_type == 'Identity') || (documentable_type == 'Identity' && documentable == identity)
end

def unique_selector
"#{documentable_type.downcase}_#{documentable_id}"
end
end
2 changes: 2 additions & 0 deletions app/views/documents/create.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
$('#doc_modal_errors').empty().append("<div class='alert alert-danger'><%= @error %></div>")
<% else %>
$('.modal').modal('hide')
unless $("span#<%= @selector %>.glyphicon").hasClass("blue-glyphicon")
$("span#<%= @selector %>.glyphicon").addClass("blue-glyphicon")
<% end %>
4 changes: 2 additions & 2 deletions app/views/notes/create.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.~

$("#modal_area").html("<%= escape_javascript(render(partial: 'index', locals: { notable: @notable, notes: @notes, notable_id: @notable_id, notable_type: @notable_type })) %>")
unless $("span#<%= @selector %>.glyphicon").hasClass("blue-notes")
$("span#<%= @selector %>.glyphicon").addClass("blue-notes")
unless $("span#<%= @selector %>.glyphicon").hasClass("blue-glyphicon")
$("span#<%= @selector %>.glyphicon").addClass("blue-glyphicon")
2 changes: 1 addition & 1 deletion spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
button_class: ''}

it "should return a blue button with white text" do
expect(helper.notes_button(params)).to have_selector(".blue-notes")
expect(helper.notes_button(params)).to have_selector(".blue-glyphicon")
end
end
end
Expand Down