diff --git a/.gitignore b/.gitignore index 7703bf6..c753546 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,9 @@ -# Ignore bundler config. /.bundle /vendor -# Ignore the default SQLite database. -/db/*.sqlite3 -/db/*.sqlite3-journal - -# Ignore all logfiles and tempfiles. /log/* /tmp/* -!/log/.keep -!/tmp/.keep /config/database.yml - -# Ignore uploaded files in development -/storage/* -!/storage/.keep - /node_modules /yarn-error.log - /public/assets .byebug_history - -# Ignore master key for decrypting credentials and more. -/config/master.key diff --git a/.ruby-version b/.ruby-version index f967d3c..57cf282 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.5.5 \ No newline at end of file +2.6.5 diff --git a/Gemfile b/Gemfile index 5a31f96..a6709ad 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.5.5' +ruby '2.6.5' gem 'rails', '~> 5.2.3' gem 'puma', '~> 3.11' diff --git a/Gemfile.lock b/Gemfile.lock index 648d6d2..bd3fd75 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -24,16 +24,16 @@ GEM erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activeadmin (2.0.0) + activeadmin (2.4.0) arbre (~> 1.2, >= 1.2.1) formtastic (~> 3.1) formtastic_i18n (~> 0.4) inherited_resources (~> 1.7) jquery-rails (~> 4.2) kaminari (~> 1.0, >= 1.0.1) - railties (>= 5.0, < 6.0) + railties (>= 5.0, < 6.1) ransack (~> 2.1, >= 2.1.1) - sass (~> 3.4) + sassc-rails (~> 2.1) sprockets (>= 3.0, < 4.1) sprockets-es6 (~> 0.9, >= 0.9.2) activejob (5.2.3) @@ -62,9 +62,9 @@ GEM babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) - bcrypt (3.1.12) - bindex (0.7.0) - bootsnap (1.4.4) + bcrypt (3.1.13) + bindex (0.8.1) + bootsnap (1.4.5) msgpack (~> 1.0) builder (3.2.3) byebug (11.0.1) @@ -76,35 +76,35 @@ GEM execjs coffee-script-source (1.12.2) concurrent-ruby (1.1.5) - crass (1.0.4) - devise (4.6.2) + crass (1.0.5) + devise (4.7.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 6.0) + railties (>= 4.1.0) responders warden (~> 1.2.3) - erubi (1.8.0) + erubi (1.9.0) execjs (2.7.0) - ffi (1.11.1) + ffi (1.11.3) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic_i18n (0.6.0) globalid (0.4.2) activesupport (>= 4.2.0) - haml (5.1.1) + haml (5.1.2) temple (>= 0.8.0) tilt has_scope (0.7.2) actionpack (>= 4.1) activesupport (>= 4.1) - i18n (1.6.0) + i18n (1.7.0) concurrent-ruby (~> 1.0) - inherited_resources (1.10.0) - actionpack (>= 5.0, < 6.0) + inherited_resources (1.11.0) + actionpack (>= 5.0, < 6.1) has_scope (~> 0.6) - railties (>= 5.0, < 6.0) - responders (~> 2.0) - jquery-rails (4.3.3) + railties (>= 5.0, < 6.1) + responders (>= 2, < 4) + jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -124,7 +124,7 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.2.3) + loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -133,15 +133,17 @@ GEM mimemagic (~> 0.3.2) method_source (0.9.2) mimemagic (0.3.3) - mini_mime (1.0.1) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) - msgpack (1.2.10) + minitest (5.13.0) + msgpack (1.3.1) mysql2 (0.5.2) - nio4r (2.3.1) - nokogiri (1.10.3) + nio4r (2.5.2) + nokogiri (1.10.5) mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) + polyamorous (2.3.0) + activerecord (>= 5.0) puma (3.12.1) rack (2.0.7) rack-test (1.1.0) @@ -162,40 +164,48 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) railties (5.2.3) actionpack (= 5.2.3) activesupport (= 5.2.3) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) - rake (12.3.2) - ransack (2.1.1) + rake (13.0.1) + ransack (2.3.0) actionpack (>= 5.0) activerecord (>= 5.0) activesupport (>= 5.0) i18n + polyamorous (= 2.3.0) rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) ruby_dep (1.5.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) + sass-rails (5.1.0) + railties (>= 5.2.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - spring (2.0.2) - activesupport (>= 4.2) + sassc (2.2.1) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + spring (2.1.0) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) @@ -210,13 +220,13 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - temple (0.8.1) + temple (0.8.2) thor (0.20.3) thread_safe (0.3.6) - tilt (2.0.9) + tilt (2.0.10) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.20) + uglifier (4.2.0) execjs (>= 0.3.0, < 3) warden (1.2.8) rack (>= 2.0.6) @@ -225,10 +235,10 @@ GEM activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.7.0) + websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) - will_paginate (3.1.7) + websocket-extensions (0.1.4) + will_paginate (3.2.1) PLATFORMS ruby @@ -253,7 +263,7 @@ DEPENDENCIES will_paginate RUBY VERSION - ruby 2.5.5p157 + ruby 2.6.5p114 BUNDLED WITH - 2.0.1 + 1.17.2 diff --git a/README.md b/README.md index 3b2fdfa..8aa0637 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,16 @@ # Ambiente Já! -This README would normally document whatever steps are necessary to get the -application up and running. +### = fase#01 -Things you may want to cover: +[ x ] Re-estructure old database -* Ruby version +[ x ] Setup web application -* System dependencies +[ x ] List articles @ sketch design -* Configuration -* Database creation +### = fase#02 -* Database initialization +[...] New design -* How to run the test suite - -* Services (job queues, cache servers, search engines, etc.) - -* Deployment instructions - -* ... +[ ] Fix informativo links diff --git a/app/assets/images/logo.png b/app/assets/images/logo.png new file mode 100644 index 0000000..8487538 Binary files /dev/null and b/app/assets/images/logo.png differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 4cba2f8..bec4452 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -14,8 +14,8 @@ $(document).ready(function(){ - var msnry = new Masonry( '#infos', { - columnWidth: 180, - itemSelector: '.card' - }); + // var msnry = new Masonry( '#infos', { + // columnWidth: 180, + // itemSelector: '.card' + // }); }); diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 7460701..e926403 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,35 +1,69 @@ body { padding: 20px; font-family: 'Inconsolata', monospace; - background-color: #f5fff1; + background-color: #fff; + color: #4c4e4d; } -a { +a{ + text-decoration: none; + color: #4c4e4d; + font-size: 17px; + font-weight: bold; +} +a:hover { color:black; } -p:hover{ - background-color: green; +#all{ + width: 900px; + margin: 0px auto; + margin-top: 35px; } -.card:hover{ - background-color: green; + +.tags{ + font-size: 13px; + margin: 5px 0px 5px 0px; +} +h2{ + margin: 0px +} +h3{ + text-align: right; + font-size:15px; +} + +#topo{ + background-color: #8bf712; + width: 100%; + text-align: center; + display: inline-block; + top: 0px; + left: 0px; + position: absolute; + font-size: 10px; + height: 35px; + border-bottom: 1px solid lightgray } .card{ - color: black; - width: 200px; - float: left; + /* color: black; */ + border-top: 1px solid lightgray; + padding-top: 10px; + padding-bottom: 10px; + /* width: 200px; */ + /* float: left; border: 2px solid green; margin: 10px; padding: 25px; font-size: 22px; text-align: center; - box-shadow: 8px 8px 3px #1a54027a; + box-shadow: 8px 8px 3px #1a54027a; */ } .date{ - font-size: 14px; + font-size: 13px; color: gray; - padding-top: 15px + padding-top: 10px } @@ -38,5 +72,7 @@ p:hover{ width: 100%; text-align: center; padding: 10px; - font-size: 19px + font-size: 19px; + background-color: #8bf712; + border: 1px solid gray; } diff --git a/app/models/informativo.rb b/app/models/informativo.rb index e69bc0d..73dfc53 100644 --- a/app/models/informativo.rb +++ b/app/models/informativo.rb @@ -1,4 +1,15 @@ class Informativo < ApplicationRecord self.table_name = "informativo" - # paginates_per 10 + paginates_per 10 + + def tags + tags = [] + tags << self.tag1 + tags << self.tag2 + tags << self.tag3 + tags = tags.uniq.join(", ").downcase + tags.chop! if tags[tags.size-1]=="," + tags + end + end diff --git a/app/views/layouts/application.haml b/app/views/layouts/application.haml index ce2d386..ff0f4f9 100644 --- a/app/views/layouts/application.haml +++ b/app/views/layouts/application.haml @@ -6,10 +6,12 @@ = csrf_meta_tags = csp_meta_tag = stylesheet_link_tag "https://fonts.googleapis.com/css?family=Inconsolata&display=swap" - = stylesheet_link_tag 'application', media: 'all' + = stylesheet_link_tag 'application', media: 'all' = javascript_include_tag 'application' %body - %h1= "Ambiente Já!" - = yield + #all + #topo + = link_to (image_tag "logo.png"), "/" + = yield diff --git a/app/views/page/home.haml b/app/views/page/home.haml index 0fb2771..1fb288c 100644 --- a/app/views/page/home.haml +++ b/app/views/page/home.haml @@ -3,8 +3,9 @@ #infos - @informativos.each do |i| .card - %span.link= link_to i.titulo, CGI.unescapeHTML("/informativo/#{i.id}") - .date= "#{i.data_inc}" + %span.link= link_to i.titulo.html_safe, CGI.unescapeHTML("/informativo/#{i.id}") + %p.tags= i.tags + .date= "#{i.data_inc} | #{i.operador_inc.downcase.capitalize}" #nav = will_paginate @informativos diff --git a/app/views/page/informativo.haml b/app/views/page/informativo.haml index 8691de5..59f4af0 100644 --- a/app/views/page/informativo.haml +++ b/app/views/page/informativo.haml @@ -1,3 +1,15 @@ -!= @informativo.Descricao -%hr -!= ap @informativo +// :javascript +// $(document).ready(function(){ +// $("a").each(function(a){ +// a.href = a.href.replace("http://localhost:3000/informativo/%22", "").replace("\"", ""); +// }) +// }); + +#todo + %h2= @informativo.titulo.html_safe + .tags= @informativo.tags + .date= @informativo.data_inc + -# %p= "Por #{@informativo.operador_inc}" + != @informativo.Descricao.gsub(""", "\"") + -# %hr + -# != ap @informativo diff --git a/config/environments/development.rb b/config/environments/development.rb index 1311e3e..371d87c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -26,6 +26,8 @@ Rails.application.configure do config.cache_store = :null_store end + + config.serve_static_assets = true # Store uploaded files on the local file system (see config/storage.yml for options) config.active_storage.service = :local diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index c6ac1d5..d5ce4a1 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -7,6 +7,7 @@ Rails.application.config.assets.version = '1.0' # Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules folder to the asset load path. Rails.application.config.assets.paths << Rails.root.join('node_modules') +Rails.application.config.assets.paths << Rails.root.join('public/images') Rails.application.config.assets.precompile += %w(application.js application.css) # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets diff --git a/masonry.pkgd.min.js b/masonry.pkgd.min.js deleted file mode 100644 index 53386ae..0000000 --- a/masonry.pkgd.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * Masonry PACKAGED v4.2.2 - * Cascading grid layout library - * https://masonry.desandro.com - * MIT License - * by David DeSandro - */ - -!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(u,n);o=void 0===o?l:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0;oe;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);s=200==Math.round(t(o.width)),r.isBoxSizeOuter=s,i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;u>l;l++){var c=h[l],f=r[c],m=parseFloat(f);a[c]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,E=d&&s,b=t(r.width);b!==!1&&(a.width=b+(E?0:p+_));var x=t(r.height);return x!==!1&&(a.height=x+(E?0:g+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+z),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;is?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},n.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},n._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",r=this[o](n,t),s={x:this.columnWidth*r.col,y:r.y},a=r.y+t.size.outerHeight,h=n+r.col,u=r.col;h>u;u++)this.colYs[u]=a;return s},n._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},n._getTopColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++)e[n]=this._getColGroupY(n,t);return e},n._getColGroupY=function(t,e){if(2>e)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},n._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,n=t>1&&i+t>this.cols;i=n?0:i;var o=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=o?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},n._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,l=a;h>=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},n._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},n._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},n.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i}); \ No newline at end of file