-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added notes to constructor #987
base: calculators-constructor
Are you sure you want to change the base?
Changes from 4 commits
8d3ead5
c7f5226
8fde9ed
5bf308a
8235899
f53c539
953013a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,3 +124,4 @@ gem "rails_db", "~> 2.4" | |
gem "meta-tags" | ||
gem "inline_svg" | ||
gem "breadcrumbs_on_rails" | ||
gem "tinymce-rails" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Controller } from '@hotwired/stimulus' | ||
|
||
export default class extends Controller { | ||
static targets = ['input'] | ||
|
||
connect() { | ||
let config = Object.assign({ target: this.inputTarget }, TinyMCERails.configuration.default ) | ||
tinymce.init(config) | ||
|
||
} | ||
|
||
disconnect () { | ||
tinymce.remove() | ||
} | ||
} | ||
|
||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ class Calculator < ApplicationRecord | |
validates :en_name, :uk_name, presence: true | ||
validates :en_name, :uk_name, length: { minimum: 3, maximum: 50 } | ||
validates :slug, presence: true, uniqueness: true | ||
validates :english_additional_notes, length: { maximum: 500 } | ||
validates :ukranian_additional_notes, length: { maximum: 500 } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ну диви, ти молодець, що додала валідацію, але тут не враховані теги, тобто я напишу одну букву, а довжина її буде 7 символів, бо буде огорнута в як мінімум тег |
||
|
||
def self.ransackable_attributes(auth_object = nil) | ||
["created_at", "id", "name", "preferable", "slug", "updated_at", "uuid"] | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,14 @@ | ||||||
<%= tinymce_assets %> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. align that all |
||||||
<div data-controller="tinymce"> | ||||||
<div class="pt-4"> | ||||||
<%= f.label :ukranian_additional_notes, t("account.calculators.new.ukranian_additional_notes") %> | ||||||
<%= f.text_area :ukranian_additional_notes, data: { tinymce_target: "input" }, class: "tinymce", rows: 20, cols: 60 %> | ||||||
</div> | ||||||
|
||||||
<div class="pt-4 pb-4"> | ||||||
<%= f.label :english_additional_notes, "English Additional Notes" %> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. то саме There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. локалізація |
||||||
<%= f.text_area :english_additional_notes, data: { tinymce_target: "input" }, class: "tinymce", rows: 20, cols: 60 %> | ||||||
</div> | ||||||
</div> | ||||||
|
||||||
<%= tinymce %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
height: 300 | ||
width: 800 | ||
menubar: false | ||
toolbar: | ||
- undo redo | blocks | bold italic | alignleft aligncenter alignright | bullist numlist outdent indent | removeformat | ||
plugins: | ||
- insertdatetime lists media table code wordcount | ||
license_key: 'gpl' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class AddLanguageNotesToCalculators < ActiveRecord::Migration[7.2] | ||
def change | ||
change_table :calculators, bulk: true do |t| | ||
t.text :ukranian_additional_notes | ||
t.text :english_additional_notes | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
порівняй тут гарно код і винеси конфіги в getter, також юзай 2 пробіли, а не 4 і думаю можна без object assign, просто обʼєкт заюзати