Skip to content

Commit

Permalink
Make the text editor a bit nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
joakimk committed Dec 5, 2024
1 parent 5518678 commit 2c71da4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
18 changes: 17 additions & 1 deletion app/views/cloud_inits/_form.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@
.span9
= bootstrap_form_for(cloud_init) do |f|
= f.text_field :name
= f.text_area :data, style: "width: 875px; height: 400px;", label: "Contents"

= f.label :data, "Contents"
div#editor style="width: 90%; height: 1200px;" = f.object.data

This comment has been minimized.

Copy link
@olleolleolle

olleolleolle Dec 5, 2024

Minor: Slim: div is implicit is you offer a #editor marker.


= f.text_area :data, id: "data", style: "display: none;"

script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.14/ace.js"
script
| var editor = ace.edit("editor");
| editor.setTheme("ace/theme/monokai");
| editor.session.setMode("ace/mode/yaml");
| editor.setFontSize(16);
| editor.session.on("change", function() {
| document.getElementById("data").value = editor.getValue();
| });


p = link_to "Cloud-init docs", "https://cloudinit.readthedocs.io/en/latest/", target: "_blank"
.form-actions
= submit_tag "Save", class: "btn btn-primary"
Expand Down
31 changes: 15 additions & 16 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@

ActiveRecord::Schema[7.1].define(version: 2024_12_03_104945) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "plpgsql"

create_table "builds", id: :serial, force: :cascade do |t|
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.string "status", limit: 255, null: false
t.string "name", limit: 255, null: false
create_table "builds", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "status", null: false
t.string "name", null: false
t.integer "revision_id"
t.string "status_url", limit: 255
t.string "status_url"
end

create_table "cloud_inits", force: :cascade do |t|
Expand All @@ -31,20 +30,20 @@
t.datetime "updated_at", null: false
end

create_table "projects", id: :serial, force: :cascade do |t|
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.string "name", limit: 255, null: false
t.string "repository", limit: 255
create_table "projects", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name", null: false
t.string "repository"
t.text "mappings"
t.integer "position", default: 0
end

create_table "revisions", id: :serial, force: :cascade do |t|
t.string "name", limit: 255, null: false
create_table "revisions", force: :cascade do |t|
t.string "name", null: false
t.integer "project_id", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

end

0 comments on commit 2c71da4

Please sign in to comment.