diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index 059ca47..0000000 --- a/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -ruby 3.1.0 diff --git a/Gemfile b/Gemfile index d6a778d..8977a91 100644 --- a/Gemfile +++ b/Gemfile @@ -170,4 +170,8 @@ gem "factory_bot", "~> 6.2" gem "pundit", "~> 2.3" +gem "image_processing", "~> 1.12" + +gem "aws-sdk-s3", "~> 1.119" + gem "timecop", "~> 0.9.6" diff --git a/Gemfile.lock b/Gemfile.lock index 7acee2e..535fb8f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -76,6 +76,22 @@ GEM activerecord (>= 3.2, < 8.0) rake (>= 10.4, < 14.0) awesome_print (1.9.2) + aws-eventstream (1.2.0) + aws-partitions (1.729.0) + aws-sdk-core (3.170.0) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.5) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.63.0) + aws-sdk-core (~> 3, >= 3.165.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.119.1) + aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.2) + aws-eventstream (~> 1, >= 1.0.2) bcrypt (3.1.18) better_errors (2.9.1) coderay (>= 1.0.0) @@ -135,6 +151,7 @@ GEM faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) + ffi (1.15.5) globalid (1.0.1) activesupport (>= 5.0) haml (6.1.1) @@ -159,6 +176,9 @@ GEM ruby_parser (~> 3.5) i18n (1.12.0) concurrent-ruby (~> 1.0) + image_processing (1.12.2) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) importmap-rails (1.1.5) actionpack (>= 6.0.0) railties (>= 6.0.0) @@ -168,6 +188,7 @@ GEM jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) + jmespath (1.6.2) json (2.6.3) json-schema (2.8.1) addressable (>= 2.4) @@ -210,6 +231,7 @@ GEM meta-tags (2.18.0) actionpack (>= 3.2.0, < 7.1) method_source (1.0.0) + mini_magick (4.12.0) mini_mime (1.1.2) minitest (5.17.0) msgpack (1.6.0) @@ -335,6 +357,8 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.12.0) + ruby-vips (2.1.4) + ffi (~> 1.12) ruby2_keywords (0.0.5) ruby_parser (3.19.2) sexp_processor (~> 4.16) @@ -421,6 +445,7 @@ DEPENDENCIES ahoy_matey annotate awesome_print + aws-sdk-s3 (~> 1.119) better_errors binding_of_caller bootsnap @@ -437,6 +462,7 @@ DEPENDENCIES hashid-rails (~> 1.0) high_voltage (~> 3.1) html2haml + image_processing (~> 1.12) importmap-rails jbuilder kaminari diff --git a/app/assets/images/confused.png b/app/assets/images/confused.png deleted file mode 100644 index 935a199..0000000 Binary files a/app/assets/images/confused.png and /dev/null differ diff --git a/app/assets/images/empty-2.png b/app/assets/images/empty-2.png deleted file mode 100644 index 0d846bc..0000000 Binary files a/app/assets/images/empty-2.png and /dev/null differ diff --git a/app/assets/images/empty.png b/app/assets/images/empty.png deleted file mode 100644 index 67ade4b..0000000 Binary files a/app/assets/images/empty.png and /dev/null differ diff --git a/app/assets/images/g_icon.png b/app/assets/images/g_icon.png deleted file mode 100644 index 8a6761c..0000000 Binary files a/app/assets/images/g_icon.png and /dev/null differ diff --git a/app/assets/images/neo-logo.png b/app/assets/images/neo-logo.png deleted file mode 100644 index 6db0262..0000000 Binary files a/app/assets/images/neo-logo.png and /dev/null differ diff --git a/app/assets/images/shy.png b/app/assets/images/shy.png deleted file mode 100644 index 7a96e8f..0000000 Binary files a/app/assets/images/shy.png and /dev/null differ diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css index 50dd2c9..bc745c7 100644 --- a/app/assets/stylesheets/application.tailwind.css +++ b/app/assets/stylesheets/application.tailwind.css @@ -5,23 +5,15 @@ @layer components { .btn-primary { - @apply justify-center rounded-full bg-gradient-to-r from-sky-500 to-purple-500 px-4 py-2 text-white transition hover:scale-105 transform duration-300 ease-in-out cursor-pointer; + @apply justify-center rounded-md border border-transparent bg-emerald-800 py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-emerald-900 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2 cursor-pointer; } .btn-secondary { - @apply justify-center rounded-full bg-gradient-to-r from-sky-500 to-purple-500 px-0.5 py-0.5 text-blue-500 transition hover:scale-105 transform duration-300 ease-in-out cursor-pointer; + @apply justify-center rounded-full border border-emerald-800 py-2 px-4 text-sm font-medium text-emerald-900 shadow-sm hover:shadow-md focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2 cursor-pointer; } - - .btn-secondary-inner { - @apply bg-white rounded-full px-3 text-sm; - } - - - - .btn-small { - @apply justify-center rounded-full border border-fuchsia-600 py-2 px-4 text-xs font-medium shadow-sm focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2 cursor-pointer hover:border-fuchsia-700; + @apply justify-center rounded-md border border-emerald-800 py-2 px-4 text-xs font-medium text-emerald-900 shadow-sm hover:bg-emerald-100 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2 cursor-pointer; } .dropdown-item { @@ -31,71 +23,33 @@ .tab { @apply text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm px-4 py-2 text-sm text-gray-700 ; } - - .radio-custom { - @apply border-gray-300 text-sky-500 transition disabled:opacity-25; - } - - .input-custom { - @apply block w-full appearance-none rounded-full border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 sm:text-sm; - } } - @layer base { - - - - .post_content > p { - @apply font-serif mb-6 - } - - h1 { - @apply text-5xl font-bold; - } - h2 { - @apply text-4xl font-bold; - } - - h3 { - @apply text-3xl font-bold mb-5; - } - h3 { - @apply text-2xl font-bold mb-5; - } - h4 { - @apply text-xl font-bold mb-5; - } - h5 { - @apply text-lg font-bold mb-5; - } - h6 { - @apply text-sm font-bold mb-5; - } - .post_content h1 { - @apply font-serif mb-5; + @apply font-serif text-5xl font-bold mb-5; } .post_content h2 { - @apply font-serif mb-5; + @apply font-serif text-4xl font-bold mb-5; } .post_content h3 { - @apply font-serif mb-5; + @apply font-serif font-serif text-3xl font-bold mb-5; } .post_content h3 { - @apply font-serif mb-5; + @apply font-serif text-2xl font-bold mb-5; } .post_content h4 { - @apply font-serif mb-5; + @apply font-serif text-xl font-bold mb-5; } .post_content h5 { - @apply font-serif mb-5; + @apply font-serif text-lg font-bold mb-5; } .post_content h6 { - @apply font-serif mb-5; + @apply font-serif text-sm font-bold mb-5; } + /* ... */ ul{ list-style-type: disc; @@ -111,6 +65,8 @@ font-size: 8px; } - + .post_content > p { + margin-bottom: 25px; + } } diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index be88b00..f888d98 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -24,9 +24,7 @@ def show if @post.draft? redirect_to edit_post_path(@post) end - if current_user.nil? || @post.user != current_user - ahoy.track "post viewed", post_id: @post.id - end + ahoy.track "post viewed", post_id: @post.id end # GET /posts/new @@ -66,7 +64,7 @@ def update respond_to do |format| if @post.update(post_params) format.turbo_stream {} - format.html {redirect_to post_path(@post)} + format.html {redirect_to root_path} else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @post.errors, status: :unprocessable_entity } @@ -113,7 +111,7 @@ def set_post # Only allow a list of trusted parameters through. def post_params - post_params = params.require(:post).permit(:body, :title, :draft_body, :publication_id) + post_params = params.require(:post).permit(:body, :title, :draft_body, :publication_id, images:[]) if post_params[:publication_id].present? post_params[:publication_id] = post_params[:publication_id].to_i.zero? ? nil : post_params[:publication_id].to_i diff --git a/app/javascript/application.js b/app/javascript/application.js index 688480d..54efac9 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -2,8 +2,11 @@ import "@hotwired/turbo-rails" import "controllers" +import "@rails/activestorage" + import Alpine from 'alpinejs' window.Alpine = Alpine -Alpine.start() \ No newline at end of file +Alpine.start() + diff --git a/app/javascript/controllers/editor_controller.js b/app/javascript/controllers/editor_controller.js index 6ef8301..baf7dae 100644 --- a/app/javascript/controllers/editor_controller.js +++ b/app/javascript/controllers/editor_controller.js @@ -1,5 +1,6 @@ import { Controller } from "@hotwired/stimulus" +import { DirectUpload } from "@rails/activestorage"; // import EditorJS from 'editor.js'; // import EditorJS from '@editorjs/editorjs'; // import Header from '@editorjs/header'; @@ -14,7 +15,7 @@ export default class extends Controller { var dataValue = {"time":1677155768141,"blocks":[{"id":"pgD-hmVDIY","type":"header","data":{"text":"","level":2}},{"id":"bDW9OO6bew","type":"paragraph","data":{"text":""}}],"version":"2.26.5"} } - console.log('dataValue') + this.editor = new EditorJS({ @@ -68,6 +69,44 @@ export default class extends Controller { // }, // }, + image: { + class: ImageTool, + config: { + + }, + + uploader: { + uploadByFile(file) { + const url = "/rails/active_storage/direct_uploads"; + const upload = new DirectUpload(file, url); + console.log('yeah') + console.log(url) + return new Promise(function (resolve, reject) { + upload.create((error, blob) => { + if (error) { + reject(error); + } else { + fetch(`/blocks/get_image_url?attachable_sgid=${blob.attachable_sgid}`) + .then((response) => response.json()) + .then((imageUrlResp) => { + console.log(imageUrlResp); + resolve({ + success: 1, + file: { + url: imageUrlResp.url, + attachable_sgid: blob.attachable_sgid, + }, + }); + }); + } + }); + }); + } + } + + + } + }, diff --git a/app/models/post.rb b/app/models/post.rb index b163c04..36d4789 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -34,6 +34,9 @@ class Post < ApplicationRecord #----- ASSOCIATIONS -----# belongs_to :user + + has_many_attached :images + belongs_to :publication, optional: true has_many :comments, dependent: :destroy diff --git a/app/models/user.rb b/app/models/user.rb index ad08513..c888834 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,6 +50,26 @@ # index_users_on_invited_by_id (invited_by_id) # index_users_on_reset_password_token (reset_password_token) UNIQUE # +# reset_password_sent_at :datetime +# reset_password_token :string +# sign_in_count :integer default(0), not null +# timezone :string default("UTC") +# uid :string +# unconfirmed_email :string +# username :string +# website :string +# created_at :datetime not null +# updated_at :datetime not null +# invited_by_id :bigint +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_invitation_token (invitation_token) UNIQUE +# index_users_on_invited_by (invited_by_type,invited_by_id) +# index_users_on_invited_by_id (invited_by_id) +# index_users_on_reset_password_token (reset_password_token) UNIQUE +# class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and @@ -134,7 +154,7 @@ def pending_acceptance? end def visited_posts - post_ids = Ahoy::Event.where(user_id: id , name: "post viewed").order(time: :desc).pluck(Arel.sql("properties ->> 'post_id'")) + post_ids = Ahoy::Event.where(user_id: 2 , name: "post viewed").order(time: :desc).pluck(Arel.sql("properties ->> 'post_id'")) Post.with_discarded.where(id: post_ids).where(discarded_at: nil) end diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index 2be798f..6d28cc2 100644 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -23,7 +23,7 @@ .py-1{:role => "none"} = button_to comment_path(comment), method: :delete, class: 'text-gray-700 flex px-4 py-2 text-sm', role: 'menuitem', tabindex: '-1' do - %svg.feather.feather-edit-2.mr-2.self-center{ fill: 'none', height: '16', stroke: 'currentColor', 'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'stroke-width': '2', viewbox: '0 0 24 24', width: '20', xmlns: 'http://www.w3.org/2000/svg' } + %svg.feather.feather-edit-2.mr-2{ fill: 'none', height: '20', stroke: 'currentColor', 'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'stroke-width': '2', viewbox: '0 0 24 24', width: '20', xmlns: 'http://www.w3.org/2000/svg' } %polyline{ points: '3 6 5 6 21 6' } %path{ d: 'M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2' } %line{ x1: '10', x2: '10', y1: '11', y2: '17' } diff --git a/app/views/comments/_form.html.haml b/app/views/comments/_form.html.haml index 25b4df8..e2b7190 100644 --- a/app/views/comments/_form.html.haml +++ b/app/views/comments/_form.html.haml @@ -1,8 +1,8 @@ = simple_form_for comment, url: comments_path do |f| - = f.input :body, as: :text, maxlength: 1000,label: false, input_html:{rows: 5, class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm'}, placeholder: "Write a comment...", required: true + = f.input :body, as: :text, maxlength: 1000,label: false, input_html:{rows: 5, class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-900 focus:outline-none focus:ring-emerald-900 sm:text-sm'}, placeholder: "Write a comment...", required: true = f.hidden_field :post_id, value: post.id .flex.items-end.mt-3 - = f.submit "Post", class: 'flex ml-auto justify-center btn-primary text-sm ' + = f.submit "Post", class: 'flex ml-auto justify-center rounded-md border border-transparent bg-emerald-800 py-2 px-5 cursor-pointer text-sm font-medium text-white shadow-sm hover:bg-emerald-900 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2' \ No newline at end of file diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index 30846bd..81cbfde 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -1,53 +1,45 @@ - title "Settings" +.flex.min-h-full.flex-col.justify-center.py-12.sm:px-6.lg:px-8 + .sm:mx-auto.sm:w-full.sm:max-w-md + %h2.mt-6.text-center.text-3xl.tracking-tight.text-gray-900.font-serif Update your profile -.flex.flex-col.mx-auto.max-w-3xl.mt-10.px-5 - = render 'user_profiles/settings_header', selected: 'account' + .mt-8.sm:mx-auto.sm:w-full.sm:max-w-md + .py-8.px-4.shadow{class: 'sm:rounded-lg.sm:px-10', "data-controller": "onboarding"} - - - - - .flex.min-h-full.flex-col.justify-center.pb-12.sm:px-6.lg:px-8 - .sm:mx-auto.sm:w-full.sm:max-w-md - %h2.mt-6.text-center.text-3xl.tracking-tight.text-gray-900 Update your profile - - .mt-8.sm:mx-auto.sm:w-full.sm:max-w-md - .py-8.px-4.shadow{class: 'sm:rounded-lg.sm:px-10', "data-controller": "onboarding"} - - = simple_form_for @user , url: registration_path(@user), method: :put do |f| - %div.mb-6 - %label.block.text-sm.font-medium.text-gray-700{for: "email"} Name - .mt-1 - - = f.input :name, label:false, input_html:{ class: 'input-custom'} - - %div - %label.block.text-sm.font-medium.text-gray-700{for: "email"} Username - .mt-1 - - = f.input :username, required: true, label: false, id: 'username' , wrapper_html: {"data-action": 'keyup->onboarding#checkUsername'}, input_html:{'data-onboarding-target': 'username', class: 'input-custom'} - - %div#username-taken.invisible.text-xs.mt-2.text-rose-500.pl-1{"data-onboarding-target" => "errorMessage"} Username already taken - - %div.mb-6 - %label.block.text-sm.font-medium.text-gray-700{for: "location"} Location - .mt-1 - - = f.input :location, label: false, input_html:{rows: 5, class: 'input-custom'} + = simple_form_for @user , url: registration_path(@user), method: :put do |f| + %div.mb-6 + %label.block.text-sm.font-medium.text-gray-700{for: "email"} Name + .mt-1 + + = f.input :name, label:false, input_html:{ class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm'} + + %div + %label.block.text-sm.font-medium.text-gray-700{for: "email"} Username + .mt-1 + + = f.input :username, required: true, label: false, id: 'username' , wrapper_html: {"data-action": 'keyup->onboarding#checkUsername'}, input_html:{'data-onboarding-target': 'username', class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm'} + + %div#username-taken.invisible.text-xs.mt-2.text-rose-500.pl-1{"data-onboarding-target" => "errorMessage"} Username already taken + + %div.mb-6 + %label.block.text-sm.font-medium.text-gray-700{for: "location"} Location + .mt-1 + + = f.input :location, label: false, input_html:{rows: 5, class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm'} + + %div.mb-6 + %label.block.text-sm.font-medium.text-gray-700{for: "email"} Bio + .mt-1 + + = f.input :bio, as: :text,maxlength: 160, label: false, input_html:{rows: 5, class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm'} + + + %div.mb-6 + %label.block.text-sm.font-medium.text-gray-700{for: "email"} Website + .mt-1 + + = f.input :website,label: false, input_html:{ class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm'} - %div.mb-6 - %label.block.text-sm.font-medium.text-gray-700{for: "email"} Bio - .mt-1 - = f.input :bio, as: :text,maxlength: 160, label: false, input_html:{rows: 5, class: 'input-custom rounded-md'} - - - %div.mb-6 - %label.block.text-sm.font-medium.text-gray-700{for: "email"} Website - .mt-1 - - = f.input :website,label: false, input_html:{ class: 'input-custom'} - - - = f.button :submit, value: 'Update', 'data-onboarding-target': 'saveButton', input_html: {"data-action": 'click->onboarding#checkUsername'},class: 'flex w-full justify-center btn-primary {type: "submit"}' + = f.button :submit, value: 'Update', 'data-onboarding-target': 'saveButton', input_html: {"data-action": 'click->onboarding#checkUsername'},class: 'flex w-full justify-center btn-primary {type: "submit"}' diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 271ce19..12b022d 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -1,11 +1,10 @@ .flex.min-h-full.flex-col.justify-center.py-12.sm:px-6.lg:px-8 .sm:mx-auto.sm:w-full.sm:max-w-md - = image_tag 'neo-logo.png', class: 'h-12 w-auto mx-auto' - - .mt-6.text-center.text-3xl.tracking-tight.text-gray-900 Create your account - .mt-2.text-center.text-sm.text-gray-600 + %img.mx-auto.h-12.w-auto{alt: "Your Company", src: url_for('/assets/logo_black.png')} + %h2.mt-6.text-center.text-3xl.tracking-tight.text-gray-900.font-serif Create your account + %p.mt-2.text-center.text-sm.text-gray-600 Or - %a.font-medium.text-purple-500.hover:text-indigo-500{href: new_user_session_path} Sign in + %a.font-medium.text-emerald-700.hover:text-emerald-500{href: new_user_session_path} Sign in .mt-8.sm:mx-auto.sm:w-full.sm:max-w-md .bg-white.py-8.px-4.shadow.sm:rounded-lg.sm:px-10 = form_for(resource, as: resource_name, url: registration_path(@user), html: { class: 'space-y-6'}) do |f| @@ -13,17 +12,17 @@ %div %label.block.text-sm.font-medium.text-gray-700{for: "email"} Email address .mt-1 - = f.email_field :email, autofocus: true, autocomplete: "email",class: '#block w-full appearance-none rounded-full border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 sm:text-sm', autocomplete: "email", name: "email", required: "", type: "email" + = f.email_field :email, autofocus: true, autocomplete: "email",class: '#block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm{autocomplete: "email", name: "email", required: "", type: "email"}' %div %label.block.text-sm.font-medium.text-gray-700{for: "password"} Password .mt-1 - = f.password_field :password, autocomplete: "new-password",class: '#block w-full appearance-none rounded-full border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 sm:text-sm{autocomplete: "current-password", name: "password", required: "", type: "password"}' + = f.password_field :password, autocomplete: "new-password",class: '#block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm{autocomplete: "current-password", name: "password", required: "", type: "password"}' %div - = f.submit "Sign up", class: 'btn-primary w-full ' + = f.submit "Sign up", class: 'flex w-full justify-center rounded-md border border-transparent bg-emerald-800 py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-emerald-900 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2{type: "submit"}' .mt-6 .relative diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 039f39f..2e698be 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,36 +1,34 @@ .flex.min-h-full.flex-col.justify-center.py-12.sm:px-6.lg:px-8 .sm:mx-auto.sm:w-full.sm:max-w-md - = image_tag 'neo-logo.png', class: 'h-12 w-auto mx-auto' - - .mt-6.text-center.text-3xl.tracking-tight.text-gray-900 Sign in - .mt-2.text-center.text-sm.text-gray-600 + %img.mx-auto.h-12.w-auto{alt: "Your Company", src: url_for('/assets/logo_black.png')} + %h2.mt-6.text-center.text-3xl.tracking-tight.text-gray-900.font-serif Sign in + %p.mt-2.text-center.text-sm.text-gray-600 Or - %a.font-medium.text-purple-500.hover:text-indigo-500{href: new_user_registration_path} Create your account - + %a.font-medium.text-emerald-700.hover:text-emerald-500{href: new_user_registration_path} Create your Account .mt-8.sm:mx-auto.sm:w-full.sm:max-w-md - .bg-white.py-8.px-4.sm:px-10.border.border-neutral-200 + .bg-white.py-8.px-4.shadow.sm:rounded-lg.sm:px-10 = form_for(resource, as: resource_name, url: session_path(resource_name),data: { turbo: false }, html: { class: 'space-y-6'}) do |f| = render "devise/shared/error_messages", resource: resource %div - %label.block.text-sm.font-medium.text-neutral-700{for: "email"} Email address + %label.block.text-sm.font-medium.text-gray-700{for: "email"} Email address .mt-1 - = f.email_field :email, autofocus: true, autocomplete: "email", placeholder: 'john@doe.com', class: 'block rounded-full text-sm w-full appearance-none border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 sm:text-sm' + = f.email_field :email, autofocus: true, autocomplete: "email",class: '#block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm{autocomplete: "email", name: "email", required: "", type: "email"}' %div %label.block.text-sm.font-medium.text-gray-700{for: "password"} Password .mt-1 - = f.password_field :password, autocomplete: "new-password",placeholder: 'Your password', class: 'block rounded-full text-sm w-full appearance-none border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 sm:text-sm{autocomplete: "current-password", name: "password", required: "", type: "password"}' + = f.password_field :password, autocomplete: "new-password",class: '#block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm{autocomplete: "current-password", name: "password", required: "", type: "password"}' .flex.items-center.justify-between .flex.items-center - = f.check_box :remember_me, id: 'remember-me', class: 'h-4 w-4 rounded border-gray-300 text-lime-400 focus:ring-lime-400{name: "remember-me", type: "checkbox"}' + = f.check_box :remember_me, id: 'remember-me', class: 'h-4 w-4 rounded border-gray-300 text-emerald-600 focus:ring-emerald-500{name: "remember-me", type: "checkbox"}' - %label.ml-2.block.text-sm.text-gray-900.cursor-pointer{for: "remember-me"} Remember me + %label.ml-2.block.text-sm.text-gray-900{for: "remember-me"} Remember me .text-sm - %a.text-gray-800.transition.hover:text-gray-900.cursor-pointer{href: new_password_path(resource_name)} Forgot your password? + %a.font-medium.text-emerald-700.hover:text-emerald-500{href: new_password_path(resource_name)} Forgot your password? %div - = f.submit "Sign in", class: 'btn-primary w-full ' + %button.flex.w-full.justify-center.rounded-md.border.border-transparent.bg-emerald-800.py-2.px-4.text-sm.font-medium.text-white.shadow-sm.hover:bg-emerald-900.focus:outline-none.focus:ring-2.focus:ring-emerald-500.focus:ring-offset-2{type: "submit"} Sign in .mt-6 .relative .absolute.inset-0.flex.items-center diff --git a/app/views/devise/shared/_links.html.haml b/app/views/devise/shared/_links.html.haml index 6659c2b..77b7a38 100644 --- a/app/views/devise/shared/_links.html.haml +++ b/app/views/devise/shared/_links.html.haml @@ -6,13 +6,8 @@ url: omniauth_authorize_path(resource_name, provider), | method: :post, | data: {turbo: "false"} do |f| - .text-center - = button_tag :submit, class: 'w-full 'do - .flex.flex-row.items-center.border.border-gray-100.py-1.rounded-full.justify-center.font-medium.gap-2.hover:scale-105transition.hover:scale-105.transform.duration-300.ease-in-out - = image_tag("g_icon.png", size: "30") - .text-gray-600.text-sm - Sign in with Google - + .text-center + = f.submit "#{omni_auth_text} with #{provider}", type: 'image', src: url_for('/assets/btn_google_signin_light_normal_web.png') diff --git a/app/views/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml index fc3b358..5fe27ce 100644 --- a/app/views/layouts/_navbar.html.haml +++ b/app/views/layouts/_navbar.html.haml @@ -1,7 +1,7 @@ - if current_user = turbo_stream_from "notifications_#{current_user.id}" -%nav.w-full.border-b.border-neutral-200.z-20.font-sans-serif{'data-controller': 'dropdown'} - .mx-auto.max-w-6xl +%nav.fixed.w-full.bg-white.shadow.z-20.font-sans-serif{'data-controller': 'dropdown'} + .mx-auto.max-w-7xl.px-4.sm:px-6.lg:px-8 .flex.h-16.justify-between .flex .-ml-2.mr-2.flex.items-center.md:hidden @@ -26,7 +26,8 @@ %path{d: "M6 18L18 6M6 6l12 12", "stroke-linecap" => "round", "stroke-linejoin" => "round"} .flex.flex-shrink-0.items-center = link_to root_path do - = image_tag 'neo-logo.png', class: 'h-9 w-auto' + %img.block.h-8.w-auto.lg:hidden{alt: "Your Company", src: url_for('/assets/logo_black.png')}/ + %img.hidden.h-8.w-auto.lg:block{alt: "Your Company",src: url_for('/assets/logo_black.png')}/ .flex.items-center - if controller_name == 'posts' && action_name == 'edit' .flex-shrink-0.mr-3 @@ -38,16 +39,15 @@ .flex-shrink-0.mr-3 - %button.relative.inline-flex.btn-primary.text-sm{type: "button"} + %button.relative.inline-flex.btn-primary{type: "button"} = link_to label, publish_post_path - if @post.published? .flex-shrink-0.mr-3 - %button.relative.inline-flex.items-center.btn-secondary{type: "button"} - - .btn-secondary-inner.py-2 - = link_to 'Unpublish Post', unpublish_post_path(@post) + %button.relative.inline-flex.items-center.bg-gray-400.px-4.py-2.text-sm.font-medium.text-white.shadow-sm.hover:bg-gray-500.focus:outline-none.focus:ring-2.focus:ring-green-500.focus:ring-offset-2{type: "button"} + + = link_to 'Unpublish Post', unpublish_post_path(@post) @@ -55,7 +55,7 @@ - else .flex-shrink-0 - %button.relative.inline-flex.items-center.btn-primary.text-sm{type: "button"} + %button.relative.inline-flex.items-center.btn-primary{type: "button"} - path = current_user.present? ? new_post_path : new_user_session_path = link_to "Write", path @@ -73,7 +73,7 @@ .absolute.bg-yellow-400.rounded-full{ class: ' top-0.5 right-1 w-4 h-4' } .text-xs.text-black#count #{current_user.notifications.unread.size} - %svg.h-7.w-7{"aria-hidden" => "true", fill: "none", stroke: "currentColor", "stroke-width" => "1.5", viewbox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg"} + %svg.h-8.w-8{"aria-hidden" => "true", fill: "none", stroke: "currentColor", "stroke-width" => "1.5", viewbox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg"} %path{d: "M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0", "stroke-linecap" => "round", "stroke-linejoin" => "round"} -# .absolute.bg-yellow-500.rounded-full{ class: ' top-0 right-0 w-2.5 h-2.5' } @@ -86,11 +86,11 @@ .text-md Notifications - .flex.flex-row.gap-2.text-blue-800.text-sm.items-center + .flex.flex-row.gap-2.text-emerald-800.text-sm.items-center %svg.feather.feather-check{:fill => "none", :height => "20", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "20", :xmlns => "http://www.w3.org/2000/svg"} %polyline{:points => "20 6 9 17 4 12"} - = button_to " Mark all as read", notifications_mark_as_read_path, method: :post, class: "text-blue-800", role: "menuitem", tabindex: "-1" + = button_to " Mark all as read", notifications_mark_as_read_path, method: :post, class: "text-emerald-800", role: "menuitem", tabindex: "-1" #notifications.text-sm @@ -109,7 +109,7 @@ .relative.ml-3.hidden.md:block %div %button#user-menu-button.flex.rounded-full.bg-white.text-sm.focus:outline-none.focus:ring-2.focus:ring-green-500.focus:ring-offset-2{"aria-expanded" => "false", "aria-haspopup" => "true", type: "button",'data-action': 'click->dropdown#toggleDropdown'} - %span.inline-block.h-7.w-7.overflow-hidden.rounded-full.bg-gray-100 + %span.inline-block.h-10.w-10.overflow-hidden.rounded-full.bg-gray-100 %svg.h-full.w-full.text-gray-300{:fill => "currentColor", :viewbox => "0 0 24 24"} %path{:d => "M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z"} / @@ -122,7 +122,7 @@ From: "transform opacity-100 scale-100" To: "transform opacity-0 scale-95" - .absolute.hidden.right-0.z-10.mt-2.w-48.origin-top-right.rounded-md.bg-white.pt-1.shadow-lg.ring-1.ring-black.ring-opacity-5.focus:outline-none{"aria-labelledby" => "user-menu-button", "aria-orientation" => "vertical", role: "menu", tabindex: "-1", 'data-dropdown-target': 'dropdown'} + .absolute.hidden.right-0.z-10.mt-2.w-48.origin-top-right.rounded-md.bg-white.py-1.shadow-lg.ring-1.ring-black.ring-opacity-5.focus:outline-none{"aria-labelledby" => "user-menu-button", "aria-orientation" => "vertical", role: "menu", tabindex: "-1", 'data-dropdown-target': 'dropdown'} / Active: "bg-gray-100", Not Active: "" - if current_user = link_to "Your Profile", user_profile_path(current_user.id), class: "dropdown-item", role: "menuitem", tabindex: "-1" diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 5b74e3f..433e54e 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -11,10 +11,7 @@ = javascript_importmap_tags = display_meta_tags site: "Writter" - %link{:href => "https://fonts.googleapis.com", :rel => "preconnect"}/ - %link{:crossorigin => "", :href => "https://fonts.gstatic.com", :rel => "preconnect"}/ - %link{:href => "https://fonts.googleapis.com/css2?family=Manrope"}/ - + %script{:src => "https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"} %script{src: "https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"} %script{src: "https://cdn.jsdelivr.net/npm/@editorjs/header@latest"} @@ -31,25 +28,19 @@ %script{src: "https://cdn.jsdelivr.net/npm/@editorjs/marker@latest"} %script{src: "https://cdn.jsdelivr.net/npm/editorjs-html@3.4.0/build/edjsHTML.js"} %script{src: "https://cdn.jsdelivr.net/npm/@albatarnik/editorjs-table@2.0.4/dist/table.min.js"} + %script{src: "https://cdn.jsdelivr.net/npm/@editorjs/image@2.3.0"} - %link{:href => "https://fonts.googleapis.com", :rel => "preconnect"}/ - %link{:crossorigin => "", :href => "https://fonts.gstatic.com", :rel => "preconnect"}/ - %link{:href => "https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700&family=Zilla+Slab:wght@400;600&display=swap", :rel => "stylesheet"}/ + - %body.h-full.font-sans-serif = render 'layouts/navbar' - .z-0.mb-20{class: ("bg-neutral-50 h-full" if controller_name == 'posts' && action_name == 'edit')} + .z-0.pt-14.pb-20.h-full{class: ("bg-neutral-50 h-full" if controller_name == 'posts' && action_name == 'edit')} = yield - - unless controller_name == 'posts' && (action_name == 'edit' || action_name == 'index') - = render partial: "shared/footer" :javascript - feather.replace() - - \ No newline at end of file + feather.replace() \ No newline at end of file diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index 3761785..f393725 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -4,11 +4,11 @@ .text-left.text-4xl.mb-5 Notifications - .flex.flex-row.gap-2.text-blue-800.text-sm.hover:underline.font-medium.items-center + .flex.flex-row.gap-2.text-emerald-800.text-sm.hover:underline.font-medium.items-center %svg.feather.feather-check{:fill => "none", :height => "20", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "20", :xmlns => "http://www.w3.org/2000/svg"} %polyline{:points => "20 6 9 17 4 12"} - = button_to " Mark all as read", notifications_mark_as_read_path, method: :post,class: "text-blue-800 hover:underline", role: "menuitem", tabindex: "-1" + = button_to " Mark all as read", notifications_mark_as_read_path, method: :post,class: "text-emerald-800 hover:underline", role: "menuitem", tabindex: "-1" - @notifications.each do |notification| = link_to notification do diff --git a/app/views/posts/_banner.html.haml b/app/views/posts/_banner.html.haml index ab0ca41..c25a437 100644 --- a/app/views/posts/_banner.html.haml +++ b/app/views/posts/_banner.html.haml @@ -24,14 +24,14 @@ %svg.h-5.w-5{"aria-hidden" => "true", :fill => "currentColor", :viewbox => "0 0 20 20", :xmlns => "http://www.w3.org/2000/svg"} %path{:d => "M10 3a1.5 1.5 0 110 3 1.5 1.5 0 010-3zM10 8.5a1.5 1.5 0 110 3 1.5 1.5 0 010-3zM11.5 15.5a1.5 1.5 0 10-3 0 1.5 1.5 0 003 0z"} - .absolute.right-0.z-10.mt-2.w-56.origin-top-right.rounded-md.bg-white.shadow-lg.ring-1.ring-black.ring-opacity-5.focus:outline-none{"aria-labelledby" => "menu-0-button", "aria-orientation" => "vertical", :role => "menu", :tabindex => "-1","x-show": "abc", "@click.outside": "open = false; abc = false"} + .absolute.right-0.z-10.mt-2.w-56.origin-top-right.rounded-md.bg-white.shadow-lg.ring-1.ring-black.ring-opacity-5.focus:outline-none{"aria-labelledby" => "menu-0-button", "aria-orientation" => "vertical", :role => "menu", :tabindex => "-1","x-show": "abc"} .py-1{:role => "none" } / Active: "bg-gray-100 text-gray-900", Not Active: "text-gray-700" - if policy(@post).update? %a#menu-0-item-0.text-gray-700.flex.px-4.py-2.text-sm{:href => edit_post_path(@post), :role => "menuitem", :tabindex => "-1", :disabled => true} - %svg.feather.feather-edit-2.mr-2.self-center{:fill => "none", :height => "16", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "18", :xmlns => "http://www.w3.org/2000/svg"} + %svg.feather.feather-edit-2.mr-2{:fill => "none", :height => "18", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "18", :xmlns => "http://www.w3.org/2000/svg"} %path{:d => "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"} @@ -41,7 +41,7 @@ %a#menu-0-item-0.text-gray-700.flex.px-4.py-2.text-sm{:href => post_path(@post), method: :delete,data: {turbo_method: :delete, turbo_confirm: 'Are you sure you want to delete this post?'}, :role => "menuitem", :tabindex => "-1", :disabled => true} - %svg.feather.feather-trash.mr-2.self-center{:fill => "none", :height => "16", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "20", :xmlns => "http://www.w3.org/2000/svg"} + %svg.feather.feather-trash.mr-2{:fill => "none", :height => "20", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "20", :xmlns => "http://www.w3.org/2000/svg"} %polyline{:points => "3 6 5 6 21 6"} %path{:d => "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"} @@ -53,33 +53,33 @@ - if @post.published? %a#menu-0-item-0.text-gray-700.flex.px-4.py-2.text-sm{:href => unpublish_post_path(@post), :data => { confirm: 'Your confirm message' }, :role => "menuitem", :tabindex => "-1"} - %svg.feather.feather-file-minus.self-center{:fill => "none", :height => "16", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "18", :xmlns => "http://www.w3.org/2000/svg"} + %svg.feather.feather-file-minus{:fill => "none", :height => "18", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "18", :xmlns => "http://www.w3.org/2000/svg"} %path{:d => "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"} %span.ml-2 Unpublish - - if current_user.publications.any? - - if @post.publication.present? - - %a#menu-0-item-0.text-gray-700.flex.px-4.py-2.text-sm.cursor-pointer{:role => "menuitem", :tabindex => "-1","x-on:click": "open = true; abc = false"} - - %svg.feather.feather-file-minus.self-center{:fill => "none", :height => "16", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "18", :xmlns => "http://www.w3.org/2000/svg"} - %path{:d => "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"} - %polyline{:points => "14 2 14 8 20 8"} - %line{:x1 => "9", :x2 => "15", :y1 => "15", :y2 => "15"} + - if @post.publication.present? - %span.ml-2{"x-on:click": "open = true"} - Remove from Publication - - - else - %a#menu-0-item-0.text-gray-700.flex.px-4.py-2.text-sm.cursor-pointer{:role => "menuitem", :tabindex => "-1","x-on:click": "open = true; abc = false"} - %svg.feather.feather-plus.self-center{:fill => "none", :height => "16", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "18", :xmlns => "http://www.w3.org/2000/svg"} - %line{:x1 => "12", :x2 => "12", :y1 => "5", :y2 => "19"} - %line{:x1 => "5", :x2 => "19", :y1 => "12", :y2 => "12"} - %span.ml-2 - Add to a publication + %a#menu-0-item-0.text-gray-700.flex.px-4.py-2.text-sm.cursor-pointer{:role => "menuitem", :tabindex => "-1"} + + %svg.feather.feather-file-minus{:fill => "none", :height => "18", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "18", :xmlns => "http://www.w3.org/2000/svg"} + %path{:d => "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"} + %polyline{:points => "14 2 14 8 20 8"} + %line{:x1 => "9", :x2 => "15", :y1 => "15", :y2 => "15"} + + %span.ml-2{"x-on:click": "open = true"} + Remove from Publication + + - else + + %a#menu-0-item-0.text-gray-700.flex.px-4.py-2.text-sm.cursor-pointer{:role => "menuitem", :tabindex => "-1","x-on:click": "open = true"} + %svg.feather.feather-plus{:fill => "none", :height => "18", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "18", :xmlns => "http://www.w3.org/2000/svg"} + %line{:x1 => "12", :x2 => "12", :y1 => "5", :y2 => "19"} + %line{:x1 => "5", :x2 => "19", :y1 => "12", :y2 => "12"} + %span.ml-2 + Add to a publication @@ -88,15 +88,15 @@ - .absolute.right-0.z-10.mt-2.pt-5.w-56.origin-top-right.rounded-md.bg-white.ring-1.ring-black.ring-opacity-5.focus:outline-none.px-4.py-2{"aria-labelledby" => "menu-0-button", "aria-orientation" => "vertical", :role => "menu", :tabindex => "-1", "x-show": "open", "@click.outside": "open = false; abc = false"} + .absolute.right-0.z-10.mt-2.w-56.origin-top-right.rounded-md.bg-white.ring-1.ring-black.ring-opacity-5.focus:outline-none.px-4.py-2{"aria-labelledby" => "menu-0-button", "aria-orientation" => "vertical", :role => "menu", :tabindex => "-1", "x-show": "open"} - if @post.publication.present? - .text-gray-700.flex.text-sm.mb-5.text-center + .text-gray-700.flex.text-sm.mb-5.text-center.pt-3 This article is currently published in #{@post.publication.name}. - = simple_form_for(@post, html: {data: { turbo: false } }) do |f| + = simple_form_for(@post, "data-turbo": "false") do |f| = f.input :publication_id, as: :hidden, input_html: { value: 0 } @@ -110,26 +110,21 @@ - else - - .text-sm.text-gray-700 - Add to one your publications: + - = simple_form_for(@post, html: { class: "py-2", data: { turbo: false } }) do |f| + = simple_form_for(@post, "data-turbo": "false", html: { class: "py-2"}) do |f| = f.collection_radio_buttons :publication_id, current_user.publications, :id, :name do |b| - .flex.flex-row.py-2.justify-between.items-center.mb-3 + .flex.flex-row.py-2.justify-between.items-center = b.label class: 'text-gray-700 flex py-2 text-sm' - = b.radio_button class: 'h-4 w-4 border-gray-300 text-sky-500 transition disabled:opacity-25' + = b.radio_button class: 'h-6 w-6 border-gray-300 text-green-800 transition disabled:opacity-25' - .flex.flex-row.form-actions.gap-5.items-center.justify-left + .flex.flex-row.form-actions.mt-5.gap-5.items-center.justify-center - = f.button :submit , 'Add Post', class: "btn-small" + = f.button :submit , 'Add Post', class: "btn-small " - .text-xs.cursor-pointer.font-medium{"x-on:click": "open = false; abc = false"} + .text-sm.text-green-900.cursor-pointer{"x-on:click": "open = false; abc = false"} Cancel - - .text-xs.text-gray-500 - A post can only be part of a single publication at any given time. - + diff --git a/app/views/posts/_card.html.haml b/app/views/posts/_card.html.haml index 9e6c138..cb8fe46 100644 --- a/app/views/posts/_card.html.haml +++ b/app/views/posts/_card.html.haml @@ -1,22 +1,9 @@ -.rounded-md.border.border-neutral-200.px-4.py-5.sm:px-6{class: 'transition hover:shadow-lg'} - - .flex.flex-row.justify-between.mb-3.items-center - %span.text-xs.text-gray-500 - = post.created_at.strftime('%d %b %Y') - .flex.flex-row.justify-between - .text-lg.font-bold.text-neutral-800.font-serif +.h-40.bg-white.max-w-xl.border.border-neutral-300.rounded-md.px-4.py-5.sm:px-6 + .flex.flex-row.text-neutral-700.justify-between + .text-lg.font-bold = post.title - .justify-between - .text-ellipsis.line-clamp-3.text-neutral-500.font-serif - = post.body_content - - .flex.flex-row.gap-1.text-sm.text-gray-500.items-end.mt-5 - - %svg.feather.feather-bar-chart-2{class: "text-[#f1b041]", :fill => "none", :height => "24", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "24", :xmlns => "http://www.w3.org/2000/svg"} - %line{:x1 => "18", :x2 => "18", :y1 => "20", :y2 => "10"} - %line{:x1 => "12", :x2 => "12", :y1 => "20", :y2 => "4"} - %line{:x1 => "6", :x2 => "6", :y1 => "20", :y2 => "14"} + %span.text-sm.uppercase + = post.created_at.strftime('%d %b %Y') - .text-center - #{post.views} views \ No newline at end of file + .text-sm \ No newline at end of file diff --git a/app/views/posts/_public_card.html.haml b/app/views/posts/_public_card.html.haml index 956dbfb..4194b04 100644 --- a/app/views/posts/_public_card.html.haml +++ b/app/views/posts/_public_card.html.haml @@ -1,28 +1,30 @@ -.rounded-md.border.border-neutral-200.px-4.py-5.sm:px-6{class: 'transition hover:shadow-lg'} +.bg-white.max-w-xl.border.border-neutral-300.rounded-md.px-4.py-5.sm:px-6 - .flex.flex-row.justify-between.mb-3.items-center - .flex.flex-row.gap-3.items-center + .flex.flex-row.justify-between.mb-3 + .flex.flex-row.gap-3 %span.inline-block.h-6.w-6.overflow-hidden.rounded-md.bg-gray-100.col-span-1 %svg.h-full.w-full.text-gray-300{:fill => "currentColor", :viewbox => "0 0 24 24"} %path{:d => "M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z"} - %span.text-sm.col-span-2.text-neutral-500.font-medium + %span.text-sm.col-span-2.text-neutral-500 = User.find(post.user_id).name - %span.text-xs.text-gray-500 + %span.text-sm.uppercase.text-gray-500 = post.created_at.strftime('%d %b %Y') .flex.flex-row.justify-between - .text-lg.font-bold.text-neutral-800.font-serif + .text-lg.font-bold.text-neutral-800 = post.title .justify-between - .text-ellipsis.line-clamp-3.text-neutral-500.font-serif + .text-sm.text-ellipsis.line-clamp-3.text-neutral-500 = post.body_content - .flex.flex-row.gap-1.text-sm.text-gray-500.items-end.mt-5 + - %svg.feather.feather-bar-chart-2{class: "text-[#f1b041]", :fill => "none", :height => "24", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "24", :xmlns => "http://www.w3.org/2000/svg"} + .flex.flex-row.gap-1.text-sm.text-gray-500.items-end.mt-10 + + %svg.feather.feather-bar-chart-2{:fill => "none", :height => "24", :stroke => "currentColor", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2", :viewbox => "0 0 24 24", :width => "24", :xmlns => "http://www.w3.org/2000/svg"} %line{:x1 => "18", :x2 => "18", :y1 => "20", :y2 => "10"} %line{:x1 => "12", :x2 => "12", :y1 => "20", :y2 => "4"} %line{:x1 => "6", :x2 => "6", :y1 => "20", :y2 => "14"} diff --git a/app/views/posts/edit.html.haml b/app/views/posts/edit.html.haml index a455d63..6b1f01a 100644 --- a/app/views/posts/edit.html.haml +++ b/app/views/posts/edit.html.haml @@ -15,8 +15,12 @@ %div{"data-editor-target": "render" } - - - + -# - @post.images.each do |image| + -# = image_tag image + -# = form_with model: @post do |form| + + -# = form.file_field :images, multiple: true + -# %br/ + -# = form.submit diff --git a/app/views/posts/index.html.haml b/app/views/posts/index.html.haml index b5cc385..170f014 100644 --- a/app/views/posts/index.html.haml +++ b/app/views/posts/index.html.haml @@ -1,39 +1,27 @@ -.grid.grid-cols-8.h-full.max-w-6xl.mx-auto.divide-x.divide-neutral-200 - .col-span-5 - .flex.flex-col.mt-10.pr-10 +.grid.grid-cols-8.mt-10.px-5.divide-x.h-full + .col-span-5.px-10 + .flex.flex-col - .text-left.font-semibold.text-2xl.mb-1{class: 'w-max'} + .text-left.font-semibold.text-2xl.mb-2 Stories & Ideas for Today - .text-left.text-sm.text-neutral-600 + .text-left.text-sm.uppercase.mb-5 #{Date.today.strftime("%A, %d %B")} - - if @posts.any? - = render 'shared/public_user_posts', posts: @posts - - else - .p-10.flex.flex-col.rounded-md.border.border-neutral-200.mt-7.bg-neutral-50 - = image_tag 'shy.png', class: 'mx-auto w-52 w-auto' - .text-center.text-neutral-800.font-semibold.text-xl.mt-7 - Looks like there are no posts for you yet. - .text-center.text-neutral-500.text-md.mt-1 - Why not follow some writters to get started? + + + = render 'shared/public_user_posts', posts: @non_authored_posts + + .col-span-3.px-10 + - if current_user + .flex.flex-col + + .text-left.font-semibold.text-2xl.mb-5 + What you've been reading... - - if current_user - .col-span-3 - .flex.flex-col.mt-10.pl-10.pb-10 - .text-left.font-bold.text-lg - What you've read recently + + = render 'shared/public_user_posts', posts: current_user.visited_posts.first(5) + - - if current_user.visited_posts.any? - = render 'shared/public_user_posts', posts: current_user.visited_posts[0..2] - - else - .p-10.flex.flex-col - = image_tag 'shy.png', class: 'mx-auto w-28 w-auto' - .text-center.text-neutral-800.font-medium.text-xl.mt-7 - You have yet to start reading. - .text-center.text-neutral-500.text-md.mt-1 - - - diff --git a/app/views/publications/_publication_card.html.haml b/app/views/publications/_publication_card.html.haml index c108d78..603efc0 100644 --- a/app/views/publications/_publication_card.html.haml +++ b/app/views/publications/_publication_card.html.haml @@ -1,21 +1,5 @@ -.flex.flex-col.mb-10.gap-5 - .flex.flex-row.items-center.justify-between - %h1 - #{@publication.name} - - .flex.flex-row.gap-2 - - if policy(@publication).update? - .btn-secondary - .btn-secondary-inner - = link_to '// Edit', edit_publication_path(@publication) - - - - if action_name == 'editor_view' - .btn-secondary - .btn-secondary-inner - = link_to '↗ Public view', publication_path(@publication), class: 'btn-secondary-inner', target: :_blank - - - .text-sm.text-slate-800 - = @publication.bio +.flex.flex-row.items-center + %h1 + #{@publication.name} + = link_to 'Public view', publication_path(@publication), class: 'btn-secondary ml-auto' \ No newline at end of file diff --git a/app/views/publications/edit.html.haml b/app/views/publications/edit.html.haml index c83da73..83961bf 100644 --- a/app/views/publications/edit.html.haml +++ b/app/views/publications/edit.html.haml @@ -12,7 +12,7 @@ %label.block.text-sm.font-medium.text-gray-700{for: "email"} Name .mt-1 - = f.input :name, label:false, input_html:{ class: 'input-custom'} + = f.input :name, label:false, input_html:{ class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm'} @@ -20,7 +20,7 @@ %label.block.text-sm.font-medium.text-gray-700{for: "email"} Bio .mt-1 - = f.input :bio, as: :text,maxlength: 160, label: false, input_html:{rows: 5, class: 'input-custom rounded-md'} + = f.input :bio, as: :text,maxlength: 160, label: false, input_html:{rows: 5, class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm'} %div.mb-6 %label.block.text-sm.font-medium.text-gray-700.mb-5 @@ -51,11 +51,11 @@ %div - .mt-2.flex.rounded-full.shadow-sm + .mt-2.flex.rounded-md.shadow-sm .relative.flex.flex-grow.items-stretch.focus-within:z-10 - %input#email.block.w-full.rounded-none.rounded-l-full.border-0.text-gray-900.ring-1.ring-inset.ring-gray-300.placeholder:text-gray-400.focus:ring-2.focus:ring-inset.focus:ring-sky-500.sm:text-sm.sm:leading-6{:class => "py-1.5", :name => "email", :placeholder => "Enter email...", :type => "email", 'data-publication-users-target': 'emailInput'}/ - %button.relative.-ml-px.inline-flex.items-center.rounded-r-full.px-3.py-2.text-sm.font-medium.text-gray-900.ring-1.ring-inset.ring-gray-300.hover:bg-gray-50{:class => "gap-x-1.5", :type => "button", "data-action": "click->publication-users#addEditor"} + %input#email.block.w-full.rounded-none.rounded-l-md.border-0.text-gray-900.ring-1.ring-inset.ring-gray-300.placeholder:text-gray-400.focus:ring-2.focus:ring-inset.focus:ring-emerald-500.sm:text-sm.sm:leading-6{:class => "py-1.5", :name => "email", :placeholder => "Enter email...", :type => "email", 'data-publication-users-target': 'emailInput'}/ + %button.relative.-ml-px.inline-flex.items-center.rounded-r-md.px-3.py-2.text-sm.font-medium.text-gray-900.ring-1.ring-inset.ring-gray-300.hover:bg-gray-50{:class => "gap-x-1.5", :type => "button", "data-action": "click->publication-users#addEditor"} Add as Editor @@ -94,8 +94,8 @@ .mt-2.flex.rounded-md.shadow-sm .relative.flex.flex-grow.items-stretch.focus-within:z-10 - %input#email.block.w-full.rounded-none.rounded-l-full.border-0.text-gray-900.ring-1.ring-inset.ring-gray-300.placeholder:text-gray-400.focus:ring-2.focus:ring-inset.focus:ring-sky-500.sm:text-sm.sm:leading-6{:class => "py-1.5", :name => "email", :placeholder => "Enter email...", :type => "email", 'data-publication-users-target': 'adminEmailInput'}/ - %button.relative.-ml-px.inline-flex.items-center.rounded-r-full.px-3.py-2.text-sm.font-medium.text-gray-900.ring-1.ring-inset.ring-gray-300.hover:bg-gray-50{:class => "gap-x-1.5", :type => "button", "data-action": "click->publication-users#addAdmin"} + %input#email.block.w-full.rounded-none.rounded-l-md.border-0.text-gray-900.ring-1.ring-inset.ring-gray-300.placeholder:text-gray-400.focus:ring-2.focus:ring-inset.focus:ring-emerald-500.sm:text-sm.sm:leading-6{:class => "py-1.5", :name => "email", :placeholder => "Enter email...", :type => "email", 'data-publication-users-target': 'adminEmailInput'}/ + %button.relative.-ml-px.inline-flex.items-center.rounded-r-md.px-3.py-2.text-sm.font-medium.text-gray-900.ring-1.ring-inset.ring-gray-300.hover:bg-gray-50{:class => "gap-x-1.5", :type => "button", "data-action": "click->publication-users#addAdmin"} Add as Admin - if policy(@publication).current_user_is_admin? diff --git a/app/views/publications/editor_view.html.haml b/app/views/publications/editor_view.html.haml index 4b58c44..3b50ab9 100644 --- a/app/views/publications/editor_view.html.haml +++ b/app/views/publications/editor_view.html.haml @@ -6,7 +6,7 @@ %div .border-b.border-gray-200.mb-10 %nav.-mb-px.flex.space-x-8{"aria-label" => "Tabs"} - - current = 'border-fuchsia-600 font-semibold text-black' + - current = 'border-green-300 font-semibold text-black' - non_selected = 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300' / Current: "border-indigo-500 text-indigo-600", Default: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" diff --git a/app/views/publications/index.html.haml b/app/views/publications/index.html.haml index 7788b0a..2437e7d 100644 --- a/app/views/publications/index.html.haml +++ b/app/views/publications/index.html.haml @@ -18,7 +18,7 @@ .flex.justify-end.mb-10 - = link_to '+ Create a New Publication', new_publication_path, class: 'text-gray-800 ' + = link_to '+ Create a New Publication', new_publication_path, class: 'text-green-900' @@ -44,7 +44,6 @@ = link_to "View", publication_path(publication), class: "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100", role: "menuitem", tabindex: "-1" = link_to "Publication Settings", edit_publication_path(publication), class: "block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100", role: "menuitem", tabindex: "-1" - - if publication.admins.size > 1 - = link_to 'Leave Publication', publication.publication_users.where(user: current_user).first, data: {turbo_method: :delete, turbo_confirm: 'Are you sure you want to leave this publication?'}, class: "block text-left px-4 py-2 text-sm text-red-400 hover:text-red-600 ", role: "menuitem", tabindex: "-1" + = link_to 'Leave Publication',publication.publication_users.where(user: current_user).first, data: {turbo_method: :delete, turbo_confirm: 'Are you sure you want to leave this publication?'}, class: "block text-left px-4 py-2 text-sm text-red-400 hover:text-red-600", role: "menuitem", tabindex: "-1" \ No newline at end of file diff --git a/app/views/publications/new.html.haml b/app/views/publications/new.html.haml index fe2f9b4..c66e986 100644 --- a/app/views/publications/new.html.haml +++ b/app/views/publications/new.html.haml @@ -10,7 +10,7 @@ %label.block.text-sm.font-medium.text-gray-700{for: "email"} Name .mt-1 - = f.input :name, label:false, input_html:{ class: 'input-custom'} + = f.input :name, label:false, input_html:{ class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm'} @@ -18,15 +18,15 @@ %label.block.text-sm.font-medium.text-gray-700{for: "email"} Bio .mt-1 - = f.input :bio, as: :text,maxlength: 160, label: false, input_html:{rows: 5, class: 'input-custom rounded-md'} + = f.input :bio, as: :text,maxlength: 160, label: false, input_html:{rows: 5, class: 'block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-emerald-500 focus:outline-none focus:ring-emerald-500 sm:text-sm'} %div.mb-10 %label.block.text-sm.font-medium.leading-6.text-gray-900{:for => "email"} Admin .mt-2 - %input#email.input-custom.disabled:cursor-not-allowed.disabled:bg-gray-50.disabled:text-gray-500.disabled:ring-gray-200.sm:text-sm.sm:leading-6{:class => "py-1.5", :disabled => "disabled", :name => "email", :placeholder => "#{current_user.name}", :type => "email", :value => "#{current_user.name}"}/ + %input#email.block.w-full.rounded-md.border-0.text-gray-900.shadow-sm.ring-1.ring-gray-300.placeholder:text-gray-400.focus:ring-2.focus:ring-inset.focus:ring-indigo-600.disabled:cursor-not-allowed.disabled:bg-gray-50.disabled:text-gray-500.disabled:ring-gray-200.sm:text-sm.sm:leading-6{:class => "py-1.5", :disabled => "disabled", :name => "email", :placeholder => "#{current_user.name}", :type => "email", :value => "#{current_user.name}"}/ %p#email-description.mt-2.text-sm.text-gray-300 You can invite other users as admins and editors later. - = f.button :submit, value: 'Create', 'data-onboarding-target': 'saveButton', input_html: {"data-action": 'click->onboarding#checkUsername'},class: 'flex w-full btn-primary {type: "submit"}' + = f.button :submit, value: 'Create', 'data-onboarding-target': 'saveButton', input_html: {"data-action": 'click->onboarding#checkUsername'},class: 'flex w-full justify-center rounded-md border border-transparent bg-emerald-800 py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-emerald-900 cursor-pointer focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2{type: "submit"}' diff --git a/app/views/publications/show.html.haml b/app/views/publications/show.html.haml index 35488bb..631bdae 100644 --- a/app/views/publications/show.html.haml +++ b/app/views/publications/show.html.haml @@ -1,13 +1,35 @@ -- title "#{@publication.name}" +-# .flex.flex-col.mx-auto.max-w-3xl.mt-10.px-5 +-# .text-center.font-sans-serif.text-4xl.mb-5 +-# = @publication.name +-# -# -link to edit publication -.flex.flex-col.mx-auto.max-w-3xl.mt-10.px-5 - = render 'publication_card' +-# - if policy(@publication).update? +-# = link_to 'Edit Publication', edit_publication_path(@publication) + +- title "#{@publication.name}" +.flex.flex-col.mx-auto.max-w-3xl.mt-10.px-5.text-center + %h1.mb-5 + = @publication.name + + - if current_user.nil? + = link_to 'Follow', new_user_session_path, class: 'relative inline-flex items-center rounded-full border border-gray px-4 py-2 text-sm font-medium shadow-sm hover:bg-green-200 hover:border hover:border-black focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 ' + - elsif current_user.following.include?(@publication) + - follow = Follow.find_by(followable_id: @publication.id, followable_type: @publication.class.to_s, user: current_user.id) + = button_to '', follow_path(follow), method: :delete, class: "relative before:content-['Following'] hover:before:content-['Unfollow'] text-center items-center rounded-full border border-gray w-28 py-2 text-sm font-medium shadow-sm hover:text-red-500 hover:border-red-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" + + - else + + = button_to "Follow", follows_path, params:{ follow: {followable_id: @publication.id, followable_type: @publication.class.to_s}}, method: :post, class: ' relative inline-flex items-center rounded-full border border-gray px-4 py-2 text-sm font-medium shadow-sm hover:bg-green-200 hover:border hover:border-black focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2' - = render 'shared/public_user_posts', posts: @publication.posts + - @publication.posts.each do |post| + = link_to post do + = render 'posts/card', post: post - if @publication.posts.empty? There are no posts on this publication yet! - \ No newline at end of file + + + diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml deleted file mode 100644 index 638c7ca..0000000 --- a/app/views/shared/_footer.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%footer.bg-white - .mx-auto.max-w-7xl.overflow-hidden.px-6.py-20.sm:py-24.lg:px-8 - %p.my-5.text-center.text-xs.leading-5.text-gray-500 - Writter - the writing platform for original ideas and creators. - - %p.my-5.text-center.text-xs.leading-5.text-gray-500 © 2023 Writter, Inc. All rights reserved. \ No newline at end of file diff --git a/app/views/shared/_private_user_posts.html.haml b/app/views/shared/_private_user_posts.html.haml index 4e9b9af..e670931 100644 --- a/app/views/shared/_private_user_posts.html.haml +++ b/app/views/shared/_private_user_posts.html.haml @@ -1,7 +1,7 @@ %div .border-b.border-gray-200.mb-10 %nav.-mb-px.flex.space-x-8{"aria-label" => "Tabs"} - - current = 'border-fuchsia-00 font-semibold text-black' + - current = 'border-green-300 font-semibold text-black' - non_selected = 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300' / Current: "border-indigo-500 text-indigo-600", Default: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" diff --git a/app/views/shared/_public_user_posts.html.haml b/app/views/shared/_public_user_posts.html.haml index 2f93ba0..dc4c9df 100644 --- a/app/views/shared/_public_user_posts.html.haml +++ b/app/views/shared/_public_user_posts.html.haml @@ -1,4 +1,5 @@ -.mb-5 +.mb-10 + .flex.flex-col.gap-3 - posts.each do |post| diff --git a/app/views/user_profiles/_follow_list.html.haml b/app/views/user_profiles/_follow_list.html.haml index b75f49a..47e39d3 100644 --- a/app/views/user_profiles/_follow_list.html.haml +++ b/app/views/user_profiles/_follow_list.html.haml @@ -3,9 +3,9 @@ %div .border-b.border-gray-200.mb-10 %nav.-mb-px.flex.space-x-8{"aria-label" => "Tabs"} - - current = 'border-fuchsia-600 font-semibold text-black' + - current = 'border-green-300 font-semibold text-black' - non_selected = 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300' - + / Current: "border-indigo-500 text-indigo-600", Default: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" %a.tab{class: "#{selected == 'Followers' ? current : non_selected }", href: followers_user_profile_path} Followers %a.tab{class: "#{selected == 'Following' ? current : non_selected }", href: following_user_profile_path} diff --git a/app/views/user_profiles/_settings_header.html.haml b/app/views/user_profiles/_settings_header.html.haml index 721130c..d898c7e 100644 --- a/app/views/user_profiles/_settings_header.html.haml +++ b/app/views/user_profiles/_settings_header.html.haml @@ -1,15 +1,13 @@ .text-left.font-semibold.text-4xl.mb-5 Settings .border-b.border-gray-200.mb-10 %nav.-mb-px.flex.space-x-8{"aria-label" => "Tabs"} - - current = 'border-fuchsia-600 font-semibold text-black' + - current = 'border-green-800 font-semibold text-black' - non_selected = 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300' - - account = selected == 'account' ? current : non_selected - publications = selected == 'publications' ? current : non_selected - notifications = selected == 'notifications' ? current : non_selected - / Current: "border-indigo-500 text-indigo-600", Default: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300" - %a.text-gray-500.hover:text-gray-700.hover:border-gray-300.whitespace-nowrap.py-4.px-1.border-b-2.font-medium.text-sm{class: "#{account}", href: edit_user_registration_path(@user)} Account + %a.text-gray-500.hover:text-gray-700.hover:border-gray-300.whitespace-nowrap.py-4.px-1.border-b-2.font-medium.text-sm{class: "#{non_selected }"} Account %a.text-gray-500.hover:text-gray-700.hover:border-gray-300.whitespace-nowrap.py-4.px-1.border-b-2.font-medium.text-sm{class: "#{notifications}", href: notifications_settings_path(id: current_user.id) } Notifications %a.text-gray-500.hover:text-gray-700.hover:border-gray-300.whitespace-nowrap.py-4.px-1.border-b-2.font-medium.text-sm{class: "#{publications}", href: publications_path} Publications diff --git a/app/views/user_profiles/_user_card.html.haml b/app/views/user_profiles/_user_card.html.haml index 0f6df20..899f147 100644 --- a/app/views/user_profiles/_user_card.html.haml +++ b/app/views/user_profiles/_user_card.html.haml @@ -1,4 +1,4 @@ -.flex.flex-row.justify-between.items-center +.flex.flex-row.justify-between .text-left.font-semibold.md:text-4xl.text-xl #{@user.name} @@ -7,16 +7,15 @@ - elsif current_user && current_user == @user .btn-secondary - .btn-secondary-inner - = link_to 'Edit Profile', edit_user_registration_path(@user) + = link_to 'Edit Profile', edit_user_registration_path(@user) - else - if current_user.following.include?(@user) - follow = Follow.find_by(followable_id: @user.id, followable_type: @user.class.to_s, user: current_user.id) - = button_to '', follow_path(follow), method: :delete, class: "relative before:content-['Following'] hover:before:content-['Unfollow'] text-center items-center rounded-full border border-gray w-28 py-1 text-sm font-medium shadow-sm hover:text-red-500 hover:border-red-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" + = button_to '', follow_path(follow), method: :delete, class: "relative before:content-['Following'] hover:before:content-['Unfollow'] text-center items-center rounded-full border border-gray w-28 py-2 text-sm font-medium shadow-sm hover:text-red-500 hover:border-red-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" - else - = button_to "Follow", follows_path, params:{ follow: {followable_id: @user.id, followable_type: @user.class.to_s}}, method: :post, class: 'btn-primary py-1 text-sm ' + = button_to "Follow", follows_path, params:{ follow: {followable_id: @user.id, followable_type: @user.class.to_s}}, method: :post, class: 'btn-secondary' .text-slate-400.mb-3.flex.flex-row.gap-3 @#{@user.username} diff --git a/app/views/user_profiles/_user_card_small.html.haml b/app/views/user_profiles/_user_card_small.html.haml index fbafea6..d8182b2 100644 --- a/app/views/user_profiles/_user_card_small.html.haml +++ b/app/views/user_profiles/_user_card_small.html.haml @@ -9,6 +9,7 @@ .absolute.top-0.right-0 + - if current_user.nil? = link_to 'Follow', new_user_session_path, class: 'btn-secondary' @@ -16,9 +17,9 @@ - follow = Follow.find_by(followable_id: user.id, followable_type: user.class.to_s, user:current_user.id) = button_to '', follow_path(follow), method: :delete, class: "relative before:content-['Following'] hover:before:content-['Unfollow'] text-center items-center rounded-full border border-gray px-5 py-2 text-xs font-medium shadow-sm hover:text-red-500 hover:border-red-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" - - elsif current_user != user - - = button_to "Follow", follows_path, params:{ follow: {followable_id: user.id, followable_type: user.class.to_s}}, method: :post, class: 'btn-primary py-1 text-sm z-40' + - else + + = button_to "Follow", follows_path, params:{ follow: {followable_id: user.id, followable_type: user.class.to_s}}, method: :post, class: 'btn-secondary z-40' %p.text-slate-500.mb-3.text-sm{class: 'md:w-3/4'} #{user.bio} diff --git a/app/views/user_profiles/notifications_settings.html.haml b/app/views/user_profiles/notifications_settings.html.haml index 72b0e10..9de85fc 100644 --- a/app/views/user_profiles/notifications_settings.html.haml +++ b/app/views/user_profiles/notifications_settings.html.haml @@ -12,7 +12,7 @@ .mt-1 %label.relative.inline-flex.items-center.cursor-pointer = f.check_box :email_notifications, checked: current_user.email_notifications, class: "sr-only peer","data-action": "change->notifications#disableFields click->notifications#submitForm" ,"data-notifications-target": 'toggle' - .w-11.h-6.bg-gray-200.peer-focus:outline-none.peer-focus:ring-sky-500.dark:peer-focus:ring-sky-500.rounded-full.peer.dark:bg-gray-700.peer-checked:after:translate-x-full.peer-checked:after:border-white.after:absolute.after:bg-white.after:border-gray-300.after:border.after:rounded-full.after:h-5.after:w-5.after:transition-all.dark:border-gray-600.peer-checked:bg-sky-500{class: "after:content-[''] after:top-[2px] after:left-[2px]"} + .w-11.h-6.bg-gray-200.peer-focus:outline-none.peer-focus:ring-green-800.dark:peer-focus:ring-green-800.rounded-full.peer.dark:bg-gray-700.peer-checked:after:translate-x-full.peer-checked:after:border-white.after:absolute.after:bg-white.after:border-gray-300.after:border.after:rounded-full.after:h-5.after:w-5.after:transition-all.dark:border-gray-600.peer-checked:bg-green-800{class: "after:content-[''] after:top-[2px] after:left-[2px]"} .flex.flex-col.gap-5{"data-notifications-target": 'fields', class: "#{current_user.email_notifications? ? '' : 'opacity-25'}"} %div @@ -22,7 +22,7 @@ = f.collection_radio_buttons :notifications_freq, User.notifications_freqs, :second, :first , checked: current_user.notifications_freq_before_type_cast do |b| .flex.flex-row.py-2.justify-between = b.label class: 'capitalize text-gray-700' - = b.radio_button class: 'h-6 w-6 radio-custom' , "data-action": "change->notifications#submitForm", disabled: !current_user.email_notifications + = b.radio_button class: 'h-6 w-6 border-gray-300 text-green-800 transition disabled:opacity-25' , "data-action": "change->notifications#submitForm", disabled: !current_user.email_notifications %div %label.block.text-md.font-bold.text-gray-900 When someone you follow publishes a new article @@ -33,7 +33,7 @@ = b.label class: 'capitalize text-gray-700' - = b.radio_button class: 'h-6 w-6 radio-custom' , "data-action": "change->notifications#submitForm", disabled: !current_user.email_notifications + = b.radio_button class: 'h-6 w-6 border-gray-300 text-green-800 disabled:opacity-25' , "data-action": "change->notifications#submitForm", disabled: !current_user.email_notifications %div @@ -43,13 +43,13 @@ = f.collection_radio_buttons :performance_notifications_freq, User.performance_notifications_freqs, :second, :first, checked: current_user.performance_notifications_freq_before_type_cast, "data-action": "change->notifications#submitForm" do |b| .flex.flex-row.py-2.justify-between = b.label class: 'capitalize text-gray-700' - = b.radio_button class: "h-6 w-6 radio-custom" , "data-action": "change->notifications#submitForm", disabled: !current_user.email_notifications + = b.radio_button class: "h-6 w-6 border-gray-300 text-green-800 disabled:opacity-25" , "data-action": "change->notifications#submitForm", disabled: !current_user.email_notifications %div .flex.flex-row.py-2.justify-between %label.block.text-md.font-bold.text-gray-900 Be alerted when new product and feature updates are released .mt-1 - = f.check_box :product_notifications, class: 'h-4 w-4 rounded border-gray-300 text-sky-500 disabled:opacity-25 focus:ring-sky-500{name: "product-notifications", type: "checkbox"}', "data-action": "change->notifications#submitForm", disabled: !current_user.email_notifications + = f.check_box :product_notifications, class: 'h-4 w-4 rounded border-gray-300 text-emerald-800 disabled:opacity-25 focus:ring-green-800{name: "product-notifications", type: "checkbox"}', "data-action": "change->notifications#submitForm", disabled: !current_user.email_notifications %div = f.submit "Update Values", class: 'hidden {type: "submit"}' diff --git a/config/credentials/development.yml.enc b/config/credentials/development.yml.enc index 92289c3..a4eebb6 100644 --- a/config/credentials/development.yml.enc +++ b/config/credentials/development.yml.enc @@ -1 +1 @@ -Qli8V0l9TV3UZmZRLobMQrOYPEH3iIMfZUyJx2r6aQUX1HpNXRh/Vi+NY+xsQ0smG3r3/amRxuyBegnzbC1mJNvQe5HWMwjiAAwHsGzlnjXof57RCb5HcxGJqZcWCSRRRXixT7/W0MlN/m6000kZg8fQmxoOTSXLbsKwGo+TxsuP4eR/I48AMWQLxwCF4m0Kx2atQPoOvzwSCwcbCxLJzGVdJRYWjrN3164YCK3wCyhBo+5zkeM6BETpvf1HC3OwRA/Hex7SrPFFZRO9ee//AAhNDeTqB3mpYs19SKjXEQ==--vx5Tq+f9MFqG4OGm--eO3uljtGdbVrP/7ynWkzbg== \ No newline at end of file +/TgwSFcVLhu1YJdgpck2xZzuavw4FO/uqF33zsUJ53x2OxsoTOjwBXvqXBYpcpYW5gnjSsUoysHG5IW0cvXNeBcr5JaIQzDb7xNTeFvPmD/4mJmrIsY+oSah/Ej4oIxGtrGX6v0fispTp8oKfq+LaZ595OpVojcFxlQRCogDnoDCP9vVkMXn3skCz/7TWqFypVY1SjAcZ9n73iT5skrs2hWdHXC+gznhfd/sUMCu50BDeeh12uqreVSX5bgEEDLYNAOMg3ludk+/TQ2XU9AYI7gDlu/1uOQjwjnETujMEoTHJu4lg8vPjYGpAsBj4mUp2txWBEwz8kzFAg7+9gtd77KMN6HymTcczpV+4aw2kizGuSUk--IYLbKInRyJUJf2Tx--aw7MxmijWZb/mcw85KZheQ== \ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index bc3b24c..a61fdc8 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -53,7 +53,7 @@ config.action_mailer.asset_host = 'http://localhost:3000' # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local + config.active_storage.service = :amazon # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false diff --git a/config/importmap.rb b/config/importmap.rb index 43bbc7b..2cd12ab 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -4,5 +4,6 @@ pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true +pin "@rails/activestorage", to: "activestorage.esm.js" pin_all_from "app/javascript/controllers", under: "controllers" pin "alpinejs", to: "https://ga.jspm.io/npm:alpinejs@3.12.0/dist/module.esm.js" diff --git a/config/storage.yml b/config/storage.yml index 4942ab6..4d7b26e 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -7,12 +7,12 @@ local: root: <%= Rails.root.join("storage") %> # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) -# amazon: -# service: S3 -# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> -# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> -# region: us-east-1 -# bucket: your_own_bucket-<%= Rails.env %> +amazon: + service: S3 + access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> + secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> + region: eu-west-1 + bucket: writter-<%= Rails.env %> # Remember not to checkin your GCS keyfile to a repository # google: diff --git a/config/tailwind.config.js b/config/tailwind.config.js index 3eb5823..1f346d3 100644 --- a/config/tailwind.config.js +++ b/config/tailwind.config.js @@ -10,8 +10,7 @@ module.exports = { theme: { extend: { fontFamily: { - sans: ['Manrope', ...defaultTheme.fontFamily.sans], - serif: ['Zilla Slab', ...defaultTheme.fontFamily.serif], + sans: ['Inter var', ...defaultTheme.fontFamily.sans], }, }, }, diff --git a/db/migrate/20230317132606_create_active_storage_tables.active_storage.rb b/db/migrate/20230317132606_create_active_storage_tables.active_storage.rb new file mode 100644 index 0000000..8a7bfe1 --- /dev/null +++ b/db/migrate/20230317132606_create_active_storage_tables.active_storage.rb @@ -0,0 +1,57 @@ +# This migration comes from active_storage (originally 20170806125915) +class CreateActiveStorageTables < ActiveRecord::Migration[5.2] + def change + # Use Active Record's configured type for primary and foreign keys + primary_key_type, foreign_key_type = primary_and_foreign_key_types + + create_table :active_storage_blobs, id: primary_key_type do |t| + t.string :key, null: false + t.string :filename, null: false + t.string :content_type + t.text :metadata + t.string :service_name, null: false + t.bigint :byte_size, null: false + t.string :checksum + + if connection.supports_datetime_with_precision? + t.datetime :created_at, precision: 6, null: false + else + t.datetime :created_at, null: false + end + + t.index [ :key ], unique: true + end + + create_table :active_storage_attachments, id: primary_key_type do |t| + t.string :name, null: false + t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type + t.references :blob, null: false, type: foreign_key_type + + if connection.supports_datetime_with_precision? + t.datetime :created_at, precision: 6, null: false + else + t.datetime :created_at, null: false + end + + t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + + create_table :active_storage_variant_records, id: primary_key_type do |t| + t.belongs_to :blob, null: false, index: false, type: foreign_key_type + t.string :variation_digest, null: false + + t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end + + private + def primary_and_foreign_key_types + config = Rails.configuration.generators + setting = config.options[config.orm][:primary_key_type] + primary_key_type = setting || :primary_key + foreign_key_type = setting || :bigint + [primary_key_type, foreign_key_type] + end +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 61af09b..d1daca7 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -49,6 +49,29 @@ # index_users_on_invited_by (invited_by_type,invited_by_id) # index_users_on_invited_by_id (invited_by_id) # index_users_on_reset_password_token (reset_password_token) UNIQUE +# + :boolean default(TRUE) +# provider :string +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# sign_in_count :integer default(0), not null +# timezone :string default("UTC") +# uid :string +# unconfirmed_email :string +# username :string +# website :string +# created_at :datetime not null +# updated_at :datetime not null +# invited_by_id :bigint +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_invitation_token (invitation_token) UNIQUE +# index_users_on_invited_by (invited_by_type,invited_by_id) +# index_users_on_invited_by_id (invited_by_id) +# index_users_on_reset_password_token (reset_password_token) UNIQUE # require 'rails_helper' require 'spec_helper' diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 705466b..4bc87c9 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -50,6 +50,12 @@ # index_users_on_invited_by_id (invited_by_id) # index_users_on_reset_password_token (reset_password_token) UNIQUE # +(email) UNIQUE +# index_users_on_invitation_token (invitation_token) UNIQUE +# index_users_on_invited_by (invited_by_type,invited_by_id) +# index_users_on_invited_by_id (invited_by_id) +# index_users_on_reset_password_token (reset_password_token) UNIQUE +# # This model initially had no columns defined. If you add columns to the # model remove the "{}" from the fixture names and add the columns immediately