Compare commits
1 Commits
main
...
hotwider-w
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a318249dc |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -38,3 +38,4 @@
|
||||
/yarn-error.log
|
||||
yarn-debug.log*
|
||||
.yarn-integrity
|
||||
.vscode
|
||||
|
||||
6
Gemfile
6
Gemfile
@@ -18,7 +18,7 @@ gem 'turbolinks', '~> 5'
|
||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||
gem 'jbuilder', '~> 2.7'
|
||||
# Use Redis adapter to run Action Cable in production
|
||||
# gem 'redis', '~> 4.0'
|
||||
gem 'redis', '~> 4.0'
|
||||
# Use Active Model has_secure_password
|
||||
# gem 'bcrypt', '~> 3.1.7'
|
||||
|
||||
@@ -41,7 +41,7 @@ group :development do
|
||||
gem 'rack-mini-profiler', '~> 2.0'
|
||||
gem 'listen', '~> 3.3'
|
||||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
||||
gem 'spring'
|
||||
gem 'spring', '~> 3.0.0'
|
||||
end
|
||||
|
||||
group :test do
|
||||
@@ -61,3 +61,5 @@ gem 'rails_admin', '~> 2.0'
|
||||
gem 'client_side_validations'
|
||||
|
||||
gem 'jquery-rails', '~> 4.3'
|
||||
|
||||
gem "hotwire-rails", "~> 0.1.3"
|
||||
|
||||
15
Gemfile.lock
15
Gemfile.lock
@@ -101,6 +101,10 @@ GEM
|
||||
haml (5.2.2)
|
||||
temple (>= 0.8.0)
|
||||
tilt
|
||||
hotwire-rails (0.1.3)
|
||||
rails (>= 6.0.0)
|
||||
stimulus-rails
|
||||
turbo-rails
|
||||
i18n (1.8.10)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jbuilder (2.11.2)
|
||||
@@ -202,6 +206,7 @@ GEM
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rbtree (0.4.4)
|
||||
redis (4.4.0)
|
||||
regexp_parser (2.1.1)
|
||||
regexp_property_values (1.0.0)
|
||||
remotipart (1.4.4)
|
||||
@@ -227,7 +232,7 @@ GEM
|
||||
sorted_set (1.0.3)
|
||||
rbtree
|
||||
set (~> 1.0)
|
||||
spring (2.1.1)
|
||||
spring (3.0.0)
|
||||
sprockets (4.0.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
@@ -236,9 +241,13 @@ GEM
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.4.2)
|
||||
stimulus-rails (0.5.4)
|
||||
rails (>= 6.0.0)
|
||||
temple (0.8.2)
|
||||
thor (1.1.0)
|
||||
tilt (2.0.10)
|
||||
turbo-rails (0.7.14)
|
||||
rails (>= 6.0.0)
|
||||
turbolinks (5.2.1)
|
||||
turbolinks-source (~> 5.2)
|
||||
turbolinks-source (5.2.0)
|
||||
@@ -276,6 +285,7 @@ DEPENDENCIES
|
||||
capybara (>= 3.26)
|
||||
client_side_validations
|
||||
devise (~> 4.8)
|
||||
hotwire-rails (~> 0.1.3)
|
||||
jbuilder (~> 2.7)
|
||||
jquery-rails (~> 4.3)
|
||||
listen (~> 3.3)
|
||||
@@ -283,9 +293,10 @@ DEPENDENCIES
|
||||
rack-mini-profiler (~> 2.0)
|
||||
rails (~> 6.1.4, >= 6.1.4.1)
|
||||
rails_admin (~> 2.0)
|
||||
redis (~> 4.0)
|
||||
sass-rails (>= 6)
|
||||
selenium-webdriver
|
||||
spring
|
||||
spring (~> 3.0.0)
|
||||
sqlite3 (~> 1.4)
|
||||
turbolinks (~> 5)
|
||||
tzinfo-data
|
||||
|
||||
20
app/controllers/hello_controller.rb
Normal file
20
app/controllers/hello_controller.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
class HelloController < ApplicationController
|
||||
before_action only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@employers = Employer.all
|
||||
@employer = Employer.new
|
||||
end
|
||||
|
||||
# def create
|
||||
# @product.increment! :retweets_count
|
||||
# redirect_to @tweet
|
||||
# end
|
||||
|
||||
private
|
||||
|
||||
# def set_tweet
|
||||
# # @tweet = Tweet.find(params[:tweet_id])
|
||||
# end
|
||||
end
|
||||
|
||||
10
app/javascript/controllers/application.js
Normal file
10
app/javascript/controllers/application.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Application } from "@hotwired/stimulus"
|
||||
|
||||
const application = Application.start()
|
||||
|
||||
// Configure Stimulus development experience
|
||||
application.warnings = true
|
||||
application.debug = false
|
||||
window.Stimulus = application
|
||||
|
||||
export { application }
|
||||
7
app/javascript/controllers/hello_controller.js
Normal file
7
app/javascript/controllers/hello_controller.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
this.element.textContent = "Hello World!"
|
||||
}
|
||||
}
|
||||
7
app/javascript/controllers/index.js
Normal file
7
app/javascript/controllers/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is auto-generated by ./bin/rails stimulus:manifest:update
|
||||
// Run that command whenever you add a new controller
|
||||
|
||||
import { application } from "./application"
|
||||
|
||||
import HelloController from "./hello_controller"
|
||||
application.register("hello", HelloController)
|
||||
@@ -5,9 +5,13 @@
|
||||
//
|
||||
import Rails from "@rails/ujs"
|
||||
import Turbolinks from "turbolinks"
|
||||
import { Turbo } from "@hotwired/turbo-rails"
|
||||
import * as ActiveStorage from "@rails/activestorage"
|
||||
import "controllers"
|
||||
import "channels"
|
||||
|
||||
Rails.start()
|
||||
Turbolinks.start()
|
||||
window.Turbo = Turbo
|
||||
Turbo.start()
|
||||
ActiveStorage.start()
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
class Employer < ApplicationRecord
|
||||
after_create_commit { broadcast_prepend_to "employers" }
|
||||
after_update_commit { broadcast_replace_to "employers" }
|
||||
after_destroy_commit { broadcast_remove_to "employers" }
|
||||
|
||||
include Recentable
|
||||
|
||||
has_many :subscriptions
|
||||
|
||||
7
app/views/employers/_employer.html.erb
Normal file
7
app/views/employers/_employer.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<%= turbo_frame_tag dom_id(employer) do %>
|
||||
<div class="card card-body">
|
||||
<div>Something </div>
|
||||
<div><%= employer.name %></div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
2
app/views/employers/_employer.json.jbuilder
Normal file
2
app/views/employers/_employer.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! employer, :id, :name
|
||||
|
||||
5
app/views/hello/_employer.html.erb
Normal file
5
app/views/hello/_employer.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<%= turbo_frame_tag dom_id(employer) do %>
|
||||
<div class="card card-body">
|
||||
<div><%= @employer.name %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
2
app/views/hello/_employer.json.jbuilder
Normal file
2
app/views/hello/_employer.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! employer, :id, :name
|
||||
|
||||
23
app/views/hello/_form.html.erb
Normal file
23
app/views/hello/_form.html.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<%= form_with(model: employer, id: dom_id(employer)) do |form| %>
|
||||
<% if employer.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(employer.errors.count, "error") %> prohibited this employer from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% tweet.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= form.label :name %>
|
||||
<%= form.text_area :name %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
243
app/views/hello/index.html.erb
Normal file
243
app/views/hello/index.html.erb
Normal file
File diff suppressed because one or more lines are too long
1
app/views/hello/index.json.jbuilder
Normal file
1
app/views/hello/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @employers, partial: "tweets/tweet", as: :employer
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
<%= bootstrap_form_with model: model, local: true do |form| %>
|
||||
V <%= form.text_field :name %>
|
||||
<%= form.text_field :name %>
|
||||
<%= form.time_zone_select(:shoot_location_time_zone, nil, label: "Time zone of shoot location") %> <div class="row align-items-center text-center mt-4">
|
||||
<%= link_to t("shared.cancel"), [project, :broadcasts], class: "col-3 text-reset" %>
|
||||
<div class="col-9">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
development:
|
||||
adapter: async
|
||||
adapter: redis
|
||||
url: redis://localhost:6379/1
|
||||
|
||||
test:
|
||||
adapter: test
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
Rails.application.routes.draw do
|
||||
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
|
||||
resources :employers do
|
||||
resource :like
|
||||
resource :retweet
|
||||
end
|
||||
root to: 'hello#index'
|
||||
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
|
||||
end
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@client-side-validations/client-side-validations": "^0.1.5",
|
||||
"@hotwired/stimulus": "^3.0.0-beta.2",
|
||||
"@hotwired/turbo-rails": "^7.0.0-rc.4",
|
||||
"@rails/actioncable": "^6.0.0",
|
||||
"@rails/activestorage": "^6.0.0",
|
||||
"@rails/ujs": "^6.0.0",
|
||||
|
||||
18
yarn.lock
generated
18
yarn.lock
generated
@@ -895,6 +895,24 @@
|
||||
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.2.tgz#30aa825f11d438671d585bd44e7fd564535fc210"
|
||||
integrity sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==
|
||||
|
||||
"@hotwired/stimulus@^3.0.0-beta.2":
|
||||
version "3.0.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.0.0-beta.2.tgz#64ca67af9cc473ca97bb99d98fee5bc08e4c3914"
|
||||
integrity sha512-rp2XojlugD0mvqi3qbqM660PbjqS7hnq/8FYa7SK/DL2rvWDu0/Ka3KW8cyXtcB1RiVG4nX5Oh4oq3nmuDjENQ==
|
||||
|
||||
"@hotwired/turbo-rails@^7.0.0-rc.4":
|
||||
version "7.0.0-rc.4"
|
||||
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.0.0-rc.4.tgz#647e7f976b1bb645a2902c131c235d7440c28e29"
|
||||
integrity sha512-ibCoMPnJRz/1CTsMywYLotq0zz2G4VZUeMiYSupzjmGFesGSJiCRiC42+iXPK/P1qwqp0WdWxSBRhfXI/wbH0A==
|
||||
dependencies:
|
||||
"@hotwired/turbo" "^7.0.0-rc.4"
|
||||
"@rails/actioncable" "^6.0.0"
|
||||
|
||||
"@hotwired/turbo@^7.0.0-rc.4":
|
||||
version "7.0.0-rc.4"
|
||||
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.0.0-rc.4.tgz#d3ab9555544534f5ec649613553e72ff6c7d7122"
|
||||
integrity sha512-4qx+6O6mUN+cSN+ZLGCOGc+2MxNrs7cFbmnWD6LIfiHAQyuNiIuB87Y5IAtOo8xj16fOBd2CdU1WRJya4Wkw0A==
|
||||
|
||||
"@npmcli/fs@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-1.0.0.tgz#589612cfad3a6ea0feafcb901d29c63fd52db09f"
|
||||
|
||||
Reference in New Issue
Block a user