Skip to content

Commit

Permalink
Remove show comments/scores buttons under machine details
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanTG committed Oct 16, 2024
1 parent 16de81f commit fcb3d19
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 110 deletions.
71 changes: 44 additions & 27 deletions app/assets/stylesheets/application.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ h1 {
}

hr {
border: 1px solid var(--medgrey);
border: 1px solid var(--purple);
width: 90%;
}

Expand Down Expand Up @@ -1183,8 +1183,8 @@ span.or {
margin: -2px -2px 0 0;
@include radius(10px);
padding: 5px 25px;
background: var(--grey);
color: var(--vlightpurple);
background: #47475f;
color: #fafaff;
font-family: $Nunito_600SemiBold;
float: right;
box-shadow: 2px 5px 10px var(--shadow);
Expand Down Expand Up @@ -1556,7 +1556,7 @@ span.machine_year_man {
}

.external_machine_link {
margin: 10px;
margin: 10px 10px 0 10px;
display: flex;
align-items: center;
}
Expand Down Expand Up @@ -1599,7 +1599,7 @@ span.machine_year_man {
-webkit-box-shadow: 2px 5px 10px var(--shadow);
padding: 5px 10px;
@include radius(10px);
margin: 10px auto 0;
margin: 20px auto 0;
border: none;
height: 26px;
font-family: $Nunito_600SemiBold;
Expand Down Expand Up @@ -1759,7 +1759,7 @@ img.machine_comment_icon {
padding-right: 5px;
}

img.machine_comment_icon:hover {
.machine_condition_lmx:hover {
cursor: pointer;
}

Expand Down Expand Up @@ -1787,7 +1787,7 @@ span.machine_condition_text {

.machine_condition_new_line span.machine_condition_date {
margin: 0 0 0 8px;
color: var(--medgrey);
color: var(--darkgrey);
font-family: $italic;
}

Expand All @@ -1800,12 +1800,12 @@ div.machine_condition_meta {
line-height: 18px;
border-bottom: 1px solid var(--purple);
margin-bottom: 10px;
padding-bottom: 5px;
padding: 0 0 5px 10px;
}

.machine_condition_new_line .machine_condition {
font-family: $Nunito_400Regular;
color: var(--darkgrey);
color: var(--dark);
}

.machine_condition_edit_lmx .edit_mode,
Expand All @@ -1822,6 +1822,14 @@ div.machine_condition_meta {
margin-bottom: 5px;
}

.machine_comments_container,
.machine_scores_container {
padding: 5px 10px 10px 10px;
margin: 20px;
border-radius: 15px;
background: var(--bg_vlightpurple);
}

#add_machine_by_id {
margin-bottom: 5px;
margin-left: 13px;
Expand Down Expand Up @@ -2175,15 +2183,8 @@ input.lookup_search_input:focus {
float: right;
}

.show_conditions_lmx {
padding: 2px;
}

.add_scores_form,
.show_scores_lmx,
.show_conditions_lmx {
padding: 5px 0 5px 5px;
background-color: var(--lightpurple);
.add_scores_form {
padding: 0 0 5px 10px;
width: 100%;
}

Expand Down Expand Up @@ -2980,23 +2981,39 @@ li span.state_name {
border-radius: 10px !important;
}

/** High Rollers **/
/** High Scores **/

.high_score {
margin-bottom: 10px;
}

.high_score_new_line {
font-family: $Nunito_400Regular;
color: var(--darkgrey);
font-family: $Nunito_600SemiBold;
color: var(--black);
display: block;
line-height: 15px;
line-height: 16px;
padding: 4px 0;
font-size: 15px;
margin-left: 5px;
font-size: 16px;
font-weight: normal;
}

.high_score_meta {
margin: 2px 0 15px 5px;
display: flex;
align-items: center;
font-size: 14px;
}

.high_score_user a {
font-family: $Nunito_700Bold;
color: var(--black);
margin-right: 10px;
}

.high_score_date {
margin: 2px 0 10px;
display: inline-block;
color: var(--medgrey);
font-size: 12px;
font-family: $italic;
color: var(--darkgrey);
}

.column .sub_nav_item {
Expand Down
11 changes: 3 additions & 8 deletions app/assets/stylesheets/mobile-application.css.erb
Original file line number Diff line number Diff line change
Expand Up @@ -839,14 +839,9 @@ span.machine_condition_text {
font-size: 14px;
}

.score_container_lmx span.high_score_date {
font-size: 15px;
font-weight: normal;
color: #666;
}

.score_container_lmx span.high_score_new_line {
font-size: 15px;
.machine_comments_container,
.machine_scores_container {
margin: 20px 15px;
}

.metadata_edit_location textarea.edit_mode,
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/location_machine_xrefs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def update_machine_condition
end

def render_machine_tools
render partial: 'location_machine_xrefs/render_machine_tools', locals: { lmx: LocationMachineXref.find(params[:id]) }
logged_in = current_user ? 'logged_in' : 'logged_out'

render partial: 'location_machine_xrefs/render_machine_tools', locals: { lmx: LocationMachineXref.find(params[:id]), logged_in: logged_in }
end

def render_machine_conditions
Expand Down
1 change: 1 addition & 0 deletions app/views/location_machine_xrefs/_machine_tools.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- icon_path = image_tag('icons/details.svg', :alt => 'Machine Details', :class => 'banner_icon')
= banner('machine_tools_lmx', 'Machine details', icon_path, lmx)
%div[lmx, :machine_tools]{:style => 'display:none'}
%hr/

:javascript
$(function() {
Expand Down
21 changes: 12 additions & 9 deletions app/views/location_machine_xrefs/_render_machine_tools.html.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
= render :partial => 'location_machine_xrefs/backglass', :locals => {:lmx => lmx}
= render :partial => 'location_machine_xrefs/ic_button', :locals => {:lmx => lmx}
= render :partial => 'machine_conditions/show_machine_conditions', :locals => {:lmx => lmx}, cached: true
= render :partial => 'location_machine_xrefs/update_machine_condition', :locals => {:lmx => lmx}
= render :partial => 'machine_score_xrefs/add_high_score', :locals => {:lmx => lmx}
= render :partial => 'machine_score_xrefs/show_high_scores', :locals => {:lmx => lmx}
%div.external_link_container
= render :partial => 'location_machine_xrefs/pintips', :locals => {:lmx => lmx}
= render :partial => 'location_machine_xrefs/kineticist', :locals => {:lmx => lmx}
- cache [logged_in, lmx] do
= render :partial => 'location_machine_xrefs/backglass', :locals => {:lmx => lmx}
%div.external_link_container
= render :partial => 'location_machine_xrefs/pintips', :locals => {:lmx => lmx}
= render :partial => 'location_machine_xrefs/kineticist', :locals => {:lmx => lmx}
= render :partial => 'location_machine_xrefs/ic_button', :locals => {:lmx => lmx}
%div.machine_comments_container
= render :partial => 'machine_conditions/show_machine_conditions', :locals => {:lmx => lmx}, cached: true
= render :partial => 'location_machine_xrefs/update_machine_condition', :locals => {:lmx => lmx}
%div.machine_scores_container
= render :partial => 'machine_score_xrefs/show_high_scores', :locals => {:lmx => lmx}
= render :partial => 'machine_score_xrefs/add_high_score', :locals => {:lmx => lmx}
2 changes: 1 addition & 1 deletion app/views/locations/_render_machine_conditions.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
});

%div.center.m_15.red.font16 Machine comments may not reflect current conditions!
%div.center.red.font16.pb_10.italic Machine comments may not reflect current conditions!

- conditions.each do |mcx|
%div{:id => "container_past_machine_condition_#{mcx.id}"}
Expand Down
9 changes: 4 additions & 5 deletions app/views/locations/_render_machines.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- location_machine_xrefs.each do |lmx|
- cache [logged_in, lmx] do
%div[lmx, :machine]
= render :partial => 'location_machine_xrefs/list_machine', :locals => {:lmx => lmx}
.clear
= render :partial => 'location_machine_xrefs/machine_tools', :locals => {:lmx => lmx}
%div[lmx, :machine]
= render :partial => 'location_machine_xrefs/list_machine', :locals => {:lmx => lmx}
.clear
= render :partial => 'location_machine_xrefs/machine_tools', :locals => {:lmx => lmx}
11 changes: 6 additions & 5 deletions app/views/locations/_render_scores.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- lmx.machine_score_xrefs.each do |msx|
%span.high_score_new_line="#{number_with_delimiter(msx.score, :delimiter => ",")}"
%span.high_score_date=msx.created_at ? msx.created_at.strftime("%b %d, %Y") : ''
- if msx.user
by
= link_to msx.user.username, "#{request.scheme}://#{request.host_with_port}/users/#{msx.user.username}/profile"
%div.high_score_new_line="#{number_with_delimiter(msx.score, :delimiter => ",")}"
%div.high_score_meta
- if msx.user
%span.high_score_user
= link_to msx.user.username, "#{request.scheme}://#{request.host_with_port}/users/#{msx.user.username}/profile"
%span.high_score_date=msx.created_at ? msx.created_at.strftime("%b %d, %Y") : ''
13 changes: 8 additions & 5 deletions app/views/machine_conditions/_show_machine_conditions.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
%div[lmx, :machineconditions_container]{:style => "display:#{lmx.sorted_machine_conditions.empty? ? 'none' : 'block'}"}
- icon_path = image_tag('icons/comment-quote.svg', :alt => 'Show Comments', :class => 'small_banner_icon')
= banner('show_conditions_lmx','Show machine comments',icon_path,lmx)
%div[lmx, :show_conditions]{:style => 'display:none'}
= render :partial => 'locations/render_machine_conditions', :locals => {:conditions => lmx.sorted_machine_conditions, :lmx => lmx}
%div.bold.font20.center.p_10.brightpurple
Machine Comments
%div[lmx, :machineconditions_container]
%div[lmx, :show_conditions]
- if lmx.sorted_machine_conditions.empty?
%div.grey.center No machine comments yet
- else
= render :partial => 'locations/render_machine_conditions', :locals => {:conditions => lmx.sorted_machine_conditions, :lmx => lmx}
8 changes: 1 addition & 7 deletions app/views/machine_score_xrefs/_add_high_score.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%span Add high score
- else
= banner('add_scores_lmx', 'Add high score', icon_path, lmx)
%div[lmx, :add_scores]{:style => 'display:none;', :class => 'add_scores_form'}
%div[lmx, :add_scores]{:style => 'display:none;', :class => 'add_scores_form mt_20'}
= form_tag machine_score_xrefs_path, :id => "add_high_score_#{lmx.id}", :method => 'post' do
= hidden_field_tag :location_machine_xref_id, lmx.id
= label_tag :score, 'Score: '
Expand All @@ -20,13 +20,7 @@
event.target.value = (parseInt(event.target.value.replace(/[^\d]+/gi, '')) || 0).toLocaleString('en-US')
);
$('#add_high_score_#{lmx.id}').submit(function () {
$('#score_container_lmx_#{lmx.id}').css('visibility', 'visible');
$('#score_container_lmx_#{lmx.id}').css('display', 'block');
$('#show_scores_lmx_#{lmx.id}').html(loadingHTML());
$('#show_scores_lmx_banner_#{lmx.id}')
.animate( { backgroundColor: "#f5f5ff" }, 1000 )
.animate( { backgroundColor: "transparent" }, 1000 );


var form = $(this);
$.post(form.attr('action'), form.serialize(), function (data) {
Expand Down
13 changes: 8 additions & 5 deletions app/views/machine_score_xrefs/_show_high_scores.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
%div[lmx, :score_container]{:style => "display:#{lmx.machine_score_xrefs.empty? ? 'none' : 'block'}"}
- icon_path = image_tag('icons/star.svg', :alt => 'Show Scores', :class => 'small_banner_icon')
= banner('show_scores_lmx', 'Show high scores', icon_path, lmx)
%div[lmx, :show_scores]{:style => 'display:none'}
= render :partial => 'locations/render_scores', :locals => {:lmx => lmx}
%div.bold.font20.center.p_10.brightpurple
High Scores
%div[lmx, :score_container]
%div[lmx, :show_scores]
- if lmx.machine_score_xrefs.empty?
%div.grey.center No scores yet
- else
= render :partial => 'locations/render_scores', :locals => {:lmx => lmx}
5 changes: 0 additions & 5 deletions spec/features/location_machine_conditions_cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
page.find("div#machine_condition_lmx_#{@lmx.id}.machine_condition_lmx .add_condition").click
fill_in("new_machine_condition_#{@lmx.id}", with: 'This is a new condition1')
page.find("input#save_machine_condition_#{@lmx.id}.save_button").click
page.find("div#show_conditions_lmx_banner_#{@lmx.id}").click

expect(page).to have_content('This is a new condition1')
end
Expand All @@ -40,7 +39,6 @@
sleep 0.5

page.find("div#machine_tools_lmx_banner_#{@lmx.id}").click
page.find("#show_conditions_lmx_banner_#{@lmx.id}").click
expect(page).to have_content('This is a new condition1')
expect(page).to have_content('Add machine comment')
expect(page).to have_content('Add high score')
Expand All @@ -53,7 +51,6 @@
sleep 0.5

page.find("div#machine_tools_lmx_banner_#{@lmx.id}").click
page.find("#show_conditions_lmx_banner_#{@lmx.id}").click
expect(page).to have_content('Add machine comment')
expect(page).to have_content('Add high score')

Expand All @@ -69,7 +66,6 @@
sleep 0.5

page.find("div#machine_tools_lmx_banner_#{@lmx.id}").click
page.find("#show_conditions_lmx_banner_#{@lmx.id}").click
expect(page).to have_content('This is a new condition1')
expect(page).to have_content('This is a new condition2')
expect(page).to have_content('Add machine comment')
Expand All @@ -82,7 +78,6 @@
sleep 0.5

page.find("div#machine_tools_lmx_banner_#{@lmx.id}").click
page.find("#show_conditions_lmx_banner_#{@lmx.id}").click
expect(page).to have_content('This is a new condition1')
expect(page).to have_content('This is a new condition2')
expect(page).to have_content('Add machine comment')
Expand Down
Loading

0 comments on commit fcb3d19

Please sign in to comment.