diff options
Diffstat (limited to 'actiontext/test/dummy/app')
28 files changed, 307 insertions, 0 deletions
diff --git a/actiontext/test/dummy/app/assets/config/manifest.js b/actiontext/test/dummy/app/assets/config/manifest.js new file mode 100644 index 0000000000..b16e53d6d5 --- /dev/null +++ b/actiontext/test/dummy/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/actiontext/test/dummy/app/assets/images/.keep b/actiontext/test/dummy/app/assets/images/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/actiontext/test/dummy/app/assets/images/.keep diff --git a/actiontext/test/dummy/app/assets/stylesheets/application.css b/actiontext/test/dummy/app/assets/stylesheets/application.css new file mode 100644 index 0000000000..e4b10eb997 --- /dev/null +++ b/actiontext/test/dummy/app/assets/stylesheets/application.css @@ -0,0 +1,16 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS + * files in this directory. Styles in this file should be added after the last require_* statement. + * It is generally better to create a new file per style scope. + * + *= require trix/dist/trix.css + *= require_tree . + *= require_self + */ diff --git a/actiontext/test/dummy/app/assets/stylesheets/messages.css b/actiontext/test/dummy/app/assets/stylesheets/messages.css new file mode 100644 index 0000000000..afad32db02 --- /dev/null +++ b/actiontext/test/dummy/app/assets/stylesheets/messages.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/actiontext/test/dummy/app/assets/stylesheets/scaffold.css b/actiontext/test/dummy/app/assets/stylesheets/scaffold.css new file mode 100644 index 0000000000..cd4f3de38d --- /dev/null +++ b/actiontext/test/dummy/app/assets/stylesheets/scaffold.css @@ -0,0 +1,80 @@ +body { + background-color: #fff; + color: #333; + margin: 33px; +} + +body, p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + +a { + color: #000; +} + +a:visited { + color: #666; +} + +a:hover { + color: #fff; + background-color: #000; +} + +th { + padding-bottom: 5px; +} + +td { + padding: 0 5px 7px; +} + +div.field, +div.actions { + margin-bottom: 10px; +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px 7px 0; + margin-bottom: 20px; + background-color: #f0f0f0; +} + +#error_explanation h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px -7px 0; + background-color: #c00; + color: #fff; +} + +#error_explanation ul li { + font-size: 12px; + list-style: square; +} + +label { + display: block; +} diff --git a/actiontext/test/dummy/app/channels/application_cable/channel.rb b/actiontext/test/dummy/app/channels/application_cable/channel.rb new file mode 100644 index 0000000000..d672697283 --- /dev/null +++ b/actiontext/test/dummy/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/actiontext/test/dummy/app/channels/application_cable/connection.rb b/actiontext/test/dummy/app/channels/application_cable/connection.rb new file mode 100644 index 0000000000..0ff5442f47 --- /dev/null +++ b/actiontext/test/dummy/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/actiontext/test/dummy/app/controllers/application_controller.rb b/actiontext/test/dummy/app/controllers/application_controller.rb new file mode 100644 index 0000000000..09705d12ab --- /dev/null +++ b/actiontext/test/dummy/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::Base +end diff --git a/actiontext/test/dummy/app/controllers/concerns/.keep b/actiontext/test/dummy/app/controllers/concerns/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/actiontext/test/dummy/app/controllers/concerns/.keep diff --git a/actiontext/test/dummy/app/controllers/messages_controller.rb b/actiontext/test/dummy/app/controllers/messages_controller.rb new file mode 100644 index 0000000000..81c79a2d1e --- /dev/null +++ b/actiontext/test/dummy/app/controllers/messages_controller.rb @@ -0,0 +1,58 @@ +class MessagesController < ApplicationController + before_action :set_message, only: [:show, :edit, :update, :destroy] + + # GET /messages + def index + @messages = Message.all + end + + # GET /messages/1 + def show + end + + # GET /messages/new + def new + @message = Message.new + end + + # GET /messages/1/edit + def edit + end + + # POST /messages + def create + @message = Message.new(message_params) + + if @message.save + redirect_to @message, notice: 'Message was successfully created.' + else + render :new + end + end + + # PATCH/PUT /messages/1 + def update + if @message.update(message_params) + redirect_to @message, notice: 'Message was successfully updated.' + else + render :edit + end + end + + # DELETE /messages/1 + def destroy + @message.destroy + redirect_to messages_url, notice: 'Message was successfully destroyed.' + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_message + @message = Message.find(params[:id]) + end + + # Only allow a trusted parameter "white list" through. + def message_params + params.require(:message).permit(:subject, :content) + end +end diff --git a/actiontext/test/dummy/app/helpers/application_helper.rb b/actiontext/test/dummy/app/helpers/application_helper.rb new file mode 100644 index 0000000000..de6be7945c --- /dev/null +++ b/actiontext/test/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/actiontext/test/dummy/app/helpers/messages_helper.rb b/actiontext/test/dummy/app/helpers/messages_helper.rb new file mode 100644 index 0000000000..f1bca9f6ca --- /dev/null +++ b/actiontext/test/dummy/app/helpers/messages_helper.rb @@ -0,0 +1,2 @@ +module MessagesHelper +end diff --git a/actiontext/test/dummy/app/javascript/packs/application.js b/actiontext/test/dummy/app/javascript/packs/application.js new file mode 100644 index 0000000000..90eb1a1841 --- /dev/null +++ b/actiontext/test/dummy/app/javascript/packs/application.js @@ -0,0 +1 @@ +import "actiontext" diff --git a/actiontext/test/dummy/app/jobs/application_job.rb b/actiontext/test/dummy/app/jobs/application_job.rb new file mode 100644 index 0000000000..a009ace51c --- /dev/null +++ b/actiontext/test/dummy/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/actiontext/test/dummy/app/mailers/application_mailer.rb b/actiontext/test/dummy/app/mailers/application_mailer.rb new file mode 100644 index 0000000000..286b2239d1 --- /dev/null +++ b/actiontext/test/dummy/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: 'from@example.com' + layout 'mailer' +end diff --git a/actiontext/test/dummy/app/models/application_record.rb b/actiontext/test/dummy/app/models/application_record.rb new file mode 100644 index 0000000000..10a4cba84d --- /dev/null +++ b/actiontext/test/dummy/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/actiontext/test/dummy/app/models/concerns/.keep b/actiontext/test/dummy/app/models/concerns/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/actiontext/test/dummy/app/models/concerns/.keep diff --git a/actiontext/test/dummy/app/models/message.rb b/actiontext/test/dummy/app/models/message.rb new file mode 100644 index 0000000000..9ea4dbfe78 --- /dev/null +++ b/actiontext/test/dummy/app/models/message.rb @@ -0,0 +1,4 @@ +class Message < ApplicationRecord + has_rich_text :content + has_rich_text :body +end diff --git a/actiontext/test/dummy/app/models/person.rb b/actiontext/test/dummy/app/models/person.rb new file mode 100644 index 0000000000..0ded356d5b --- /dev/null +++ b/actiontext/test/dummy/app/models/person.rb @@ -0,0 +1,7 @@ +class Person < ApplicationRecord + include ActionText::Attachable + + def to_trix_content_attachment_partial_path + "people/trix_content_attachment" + end +end diff --git a/actiontext/test/dummy/app/views/layouts/application.html.erb b/actiontext/test/dummy/app/views/layouts/application.html.erb new file mode 100644 index 0000000000..f221f512b7 --- /dev/null +++ b/actiontext/test/dummy/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html> + <head> + <title>Dummy</title> + <%= csrf_meta_tags %> + + <%= stylesheet_link_tag 'application', media: 'all' %> + <%= javascript_pack_tag 'application' %> + </head> + + <body> + <%= yield %> + </body> +</html> diff --git a/actiontext/test/dummy/app/views/layouts/mailer.html.erb b/actiontext/test/dummy/app/views/layouts/mailer.html.erb new file mode 100644 index 0000000000..cbd34d2e9d --- /dev/null +++ b/actiontext/test/dummy/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <style> + /* Email styles need to be inline */ + </style> + </head> + + <body> + <%= yield %> + </body> +</html> diff --git a/actiontext/test/dummy/app/views/layouts/mailer.text.erb b/actiontext/test/dummy/app/views/layouts/mailer.text.erb new file mode 100644 index 0000000000..37f0bddbd7 --- /dev/null +++ b/actiontext/test/dummy/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/actiontext/test/dummy/app/views/messages/_form.html.erb b/actiontext/test/dummy/app/views/messages/_form.html.erb new file mode 100644 index 0000000000..3b8a174884 --- /dev/null +++ b/actiontext/test/dummy/app/views/messages/_form.html.erb @@ -0,0 +1,27 @@ +<%= form_with(model: message, local: true) do |form| %> + <% if message.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(message.errors.count, "error") %> prohibited this message from being saved:</h2> + + <ul> + <% message.errors.full_messages.each do |message| %> + <li><%= message %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= form.label :subject %> + <%= form.text_field :subject %> + </div> + + <div class="field"> + <%= form.label :content %> + <%= form.rich_text_area :content, class: "trix-content" %> + </div> + + <div class="actions"> + <%= form.submit %> + </div> +<% end %> diff --git a/actiontext/test/dummy/app/views/messages/edit.html.erb b/actiontext/test/dummy/app/views/messages/edit.html.erb new file mode 100644 index 0000000000..90ad68c788 --- /dev/null +++ b/actiontext/test/dummy/app/views/messages/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing Message</h1> + +<%= render 'form', message: @message %> + +<%= link_to 'Show', @message %> | +<%= link_to 'Back', messages_path %> diff --git a/actiontext/test/dummy/app/views/messages/index.html.erb b/actiontext/test/dummy/app/views/messages/index.html.erb new file mode 100644 index 0000000000..a8c97468c6 --- /dev/null +++ b/actiontext/test/dummy/app/views/messages/index.html.erb @@ -0,0 +1,29 @@ +<p id="notice"><%= notice %></p> + +<h1>Messages</h1> + +<table> + <thead> + <tr> + <th>Subject</th> + <th>Content</th> + <th colspan="3"></th> + </tr> + </thead> + + <tbody> + <% @messages.each do |message| %> + <tr> + <td><%= message.subject %></td> + <td><%= message.content %></td> + <td><%= link_to 'Show', message %></td> + <td><%= link_to 'Edit', edit_message_path(message) %></td> + <td><%= link_to 'Destroy', message, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Message', new_message_path %> diff --git a/actiontext/test/dummy/app/views/messages/new.html.erb b/actiontext/test/dummy/app/views/messages/new.html.erb new file mode 100644 index 0000000000..6cbd3b8ffe --- /dev/null +++ b/actiontext/test/dummy/app/views/messages/new.html.erb @@ -0,0 +1,5 @@ +<h1>New Message</h1> + +<%= render 'form', message: @message %> + +<%= link_to 'Back', messages_path %> diff --git a/actiontext/test/dummy/app/views/messages/show.html.erb b/actiontext/test/dummy/app/views/messages/show.html.erb new file mode 100644 index 0000000000..25fad1efba --- /dev/null +++ b/actiontext/test/dummy/app/views/messages/show.html.erb @@ -0,0 +1,13 @@ +<p id="notice"><%= notice %></p> + +<p> + <strong>Subject:</strong> + <%= @message.subject %> +</p> + +<div class="trix-content"> + <%= @message.content.html_safe %> +</div> + +<%= link_to 'Edit', edit_message_path(@message) %> | +<%= link_to 'Back', messages_path %> diff --git a/actiontext/test/dummy/app/views/people/_trix_content_attachment.html.erb b/actiontext/test/dummy/app/views/people/_trix_content_attachment.html.erb new file mode 100644 index 0000000000..7db2334126 --- /dev/null +++ b/actiontext/test/dummy/app/views/people/_trix_content_attachment.html.erb @@ -0,0 +1,3 @@ +<span class="mentionable-person" gid="<%= person.to_gid %>"> + <%= person.name %> +</span> |