From eed9d72f1005fb8dcb2e7e050e4975dea7798276 Mon Sep 17 00:00:00 2001 From: higormoles Date: Sat, 30 Nov 2019 02:11:43 -0300 Subject: [PATCH 1/4] =?UTF-8?q?Refatora=C3=A7=C3=A3o=20aplication.js=20par?= =?UTF-8?q?a=20corre=C3=A7=C3=A3o=20de=20mal=20cheiro=20de=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app/assets/javascripts/application.js | 43 ++++++++----------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/src/app/app/assets/javascripts/application.js b/src/app/app/assets/javascripts/application.js index c0f402bc..09e7f5a7 100644 --- a/src/app/app/assets/javascripts/application.js +++ b/src/app/app/assets/javascripts/application.js @@ -35,36 +35,27 @@ function resizeIcons() { $( window ).on( 'load', resizeIcons ); $( window ).on( 'resize', resizeIcons ); -$(document).ready(function(){ - $('.favorite_colleges#show .jumbotron .collegebox .college').click(function() { - var $this = $(this).children('.details'); - - var openDetails = $('.favorite_colleges#show .jumbotron .collegebox .college .details').not($this).filter(function () { - return this.style.display == 'block' - }); - openDetails.css('display', 'none'); +var htmlClasses = ['.favorite_colleges#show .jumbotron .collegebox .college', '.colleges#index .jumbotron .collegebox .college']; - if( $this.css('display') === 'block' ){ - $this.css('display', 'none'); - } else { - $this.css('display', 'block'); - } - }); +$(document).ready(function(){ - $('.colleges#index .jumbotron .collegebox .college').click(function() { - var $this = $(this).children('.details'); + for(var i = 0; i Date: Sat, 30 Nov 2019 02:41:18 -0300 Subject: [PATCH 2/4] =?UTF-8?q?Ajuste=20aplication.js=20corre=C3=A7=C3=A3o?= =?UTF-8?q?=20property=20length?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app/assets/javascripts/application.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/app/assets/javascripts/application.js b/src/app/app/assets/javascripts/application.js index 09e7f5a7..201086f6 100644 --- a/src/app/app/assets/javascripts/application.js +++ b/src/app/app/assets/javascripts/application.js @@ -35,16 +35,16 @@ function resizeIcons() { $( window ).on( 'load', resizeIcons ); $( window ).on( 'resize', resizeIcons ); -var htmlClasses = ['.favorite_colleges#show .jumbotron .collegebox .college', '.colleges#index .jumbotron .collegebox .college']; - $(document).ready(function(){ - for(var i = 0; i Date: Sat, 30 Nov 2019 03:00:21 -0300 Subject: [PATCH 3/4] =?UTF-8?q?Ajuste=20college=5Fwhitelists=5Fcontroller?= =?UTF-8?q?=20para=20consertar=20cheiros=20de=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../college_whitelists_controller.rb | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/app/app/controllers/college_whitelists_controller.rb b/src/app/app/controllers/college_whitelists_controller.rb index ef06c8ec..bea39ef7 100644 --- a/src/app/app/controllers/college_whitelists_controller.rb +++ b/src/app/app/controllers/college_whitelists_controller.rb @@ -7,20 +7,7 @@ def verify_permission if @college.request_to_participate == "0" redirect_to college_spotteds_path(college_id: @college.id) else - @college_whitelist = CollegeWhitelist.find_by(user_id: current_user.id, college_id: @college.id) - if !@college_whitelist.nil? - case @college_whitelist.status - when "approved" - redirect_to college_spotteds_path(college_id: @college.id) - when "pending" - render :template => "college_whitelists/pending" - when "rejected" - render :template => "college_whitelists/rejected" - end - else - @college_whitelist = CollegeWhitelist.new - render :new - end + check_college_access_permission end end @@ -119,4 +106,27 @@ def set_college def college_whitelist_params params.require(:college_whitelist).permit(:status) end + + def check_college_access_permission + @college_whitelist = CollegeWhitelist.find_by(user_id: current_user.id, college_id: @college.id) + if !@college_whitelist.nil? + check_request_access_status(@college_whitelist) + else + @college_whitelist = CollegeWhitelist.new + render :new + end + end + + def check_request_access_status(college_whitelist) + case college_whitelist.status + when "approved" + redirect_to college_spotteds_path(college_id: @college.id) + when "pending" + render :template => "college_whitelists/pending" + when "rejected" + render :template => "college_whitelists/rejected" + end + end + + end \ No newline at end of file From 308c54cfb375d55ca5c0256610a8f409a241c9ac Mon Sep 17 00:00:00 2001 From: higormoles Date: Sat, 30 Nov 2019 03:19:34 -0300 Subject: [PATCH 4/4] =?UTF-8?q?Ajuste=20spotted=20controller=20conserto=20?= =?UTF-8?q?de=20cheiro=20de=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app/controllers/spotteds_controller.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app/app/controllers/spotteds_controller.rb b/src/app/app/controllers/spotteds_controller.rb index 3445c9e6..51a00f40 100644 --- a/src/app/app/controllers/spotteds_controller.rb +++ b/src/app/app/controllers/spotteds_controller.rb @@ -84,13 +84,24 @@ def set_college def set_style @college_style = '' + check_to_set_background_image + check_to_set_background_color + check_to_set_font_family_and_color + end + def check_to_set_background_image if @college.background_image.present? @college_style.concat('body { background-image: url(' + @college.background_image + '); }') - elsif @college.background_color.present? + end + end + + def check_to_set_background_color + if @college.background_color.present? @college_style.concat('body { background-color:' + @college.background_color + ';}') end - + end + + def check_to_set_font_family_and_color if @college.font_family.present? && @college.font_color.present? @college_style.concat('#content-container { font-family: ' + @college.font_family + '!important; color: ' + @college.font_color + '; }') elsif @college.font_family.present? @@ -100,6 +111,7 @@ def set_style end end + def set_font_google response = HTTParty.get('https://fonts.googleapis.com/css?family=' + @college.font_family)