This repository has been archived by the owner on Feb 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from MyDry/develop
Develop
- Loading branch information
Showing
45 changed files
with
1,132 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,4 +291,4 @@ RUBY VERSION | |
ruby 2.5.1p57 | ||
|
||
BUNDLED WITH | ||
1.16.4 | ||
1.17.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.random-words { | ||
.random-tool { | ||
text-align: center; | ||
font-size: 10vh; | ||
a { | ||
font-size: 5vh; | ||
text-decoration: none; | ||
} | ||
} | ||
.words-index { | ||
background-color: lightgray; | ||
font-size: 2vh; | ||
} | ||
.word-form { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,59 @@ | ||
class MandalartsController < ApplicationController | ||
def index | ||
@simple_mandals = current_user.simple_mandals | ||
end | ||
|
||
def show | ||
@simple_mandal = SimpleMandal.find(params[:id]) | ||
end | ||
|
||
def new | ||
@simple_mandal = SimpleMandal.new | ||
end | ||
|
||
def create | ||
@simple_mandal = current_user.simple_mandals.build(simple_mandal_params) | ||
@simple_mandal.save | ||
redirect_to mandalart_path(id: @simple_mandal) | ||
end | ||
|
||
private | ||
def simple_mandal_params | ||
params.require(:simple_mandal).permit( | ||
:elem_1_1, :elem_1_2, :elem_1_3, | ||
:elem_1_4, :elem_1_5, :elem_1_6, | ||
:elem_1_7, :elem_1_8, :elem_1_9, | ||
|
||
:elem_2_1, :elem_2_2, :elem_2_3, | ||
:elem_2_4, :elem_2_5, :elem_2_6, | ||
:elem_2_7, :elem_2_8, :elem_2_9, | ||
|
||
:elem_3_1, :elem_3_2, :elem_3_3, | ||
:elem_3_4, :elem_3_5, :elem_3_6, | ||
:elem_3_7, :elem_3_8, :elem_3_9, | ||
|
||
:elem_4_1, :elem_4_2, :elem_4_3, | ||
:elem_4_4, :elem_4_5, :elem_4_6, | ||
:elem_4_7, :elem_4_8, :elem_4_9, | ||
|
||
:elem_5_1, :elem_5_2, :elem_5_3, | ||
:elem_5_4, :elem_5_5, :elem_5_6, | ||
:elem_5_7, :elem_5_8, :elem_5_9, | ||
|
||
:elem_6_1, :elem_6_2, :elem_6_3, | ||
:elem_6_4, :elem_6_5, :elem_6_6, | ||
:elem_6_7, :elem_6_8, :elem_6_9, | ||
|
||
:elem_7_1, :elem_7_2, :elem_7_3, | ||
:elem_7_4, :elem_7_5, :elem_7_6, | ||
:elem_7_7, :elem_7_8, :elem_7_9, | ||
|
||
:elem_8_1, :elem_8_2, :elem_8_3, | ||
:elem_8_4, :elem_8_5, :elem_8_6, | ||
:elem_8_7, :elem_8_8, :elem_8_9, | ||
|
||
:elem_9_1, :elem_9_2, :elem_9_3, | ||
:elem_9_4, :elem_9_5, :elem_9_6, | ||
:elem_9_7, :elem_9_8, :elem_9_9) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,6 @@ def destroy | |
@user.destroy | ||
flash[:success] = "ユーザーを削除しました" | ||
redirect_to users_path | ||
|
||
end | ||
|
||
private | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
class WordsController < ApplicationController | ||
before_action :admin_user, only: :destroy | ||
|
||
def index | ||
@words = Word.all | ||
random_words = Word.order("RANDOM()").limit(2) | ||
@word1 = random_words[0] | ||
@word2 = random_words[1] | ||
end | ||
|
||
def new | ||
@word = Word.new | ||
end | ||
|
||
def create | ||
@word = Word.new(word_params) | ||
if @word.save | ||
redirect_to words_path | ||
else | ||
render 'new' | ||
end | ||
end | ||
|
||
def destroy | ||
@word = Word.find_by(params[:id]) | ||
@word.destroy | ||
flash[:success] = "単語を削除しました" | ||
redirect_to words_path | ||
end | ||
|
||
private | ||
|
||
def word_params | ||
params.require(:word).permit(:word) | ||
end | ||
|
||
def admin_user | ||
redirect_to root_path unless current_user.admin? | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,3 @@ | ||
module MandalartsHelper | ||
def show_sub_elem(subNum) | ||
content_tag(:div, id: subNum, style: 'visibility: hidden;') do | ||
default_attributes = {type: 'sub'} | ||
core_attributes = default_attributes.merge({ style: 'visibility: hidden; border: 1px dotted #999;'}) | ||
(1..9).each do |n| | ||
attributes = (n == 5) ? core_attributes : default_attributes | ||
concat content_tag(:textarea, ' ', { id: "#{subNum}-#{n}" }.merge(attributes)) | ||
end | ||
end | ||
end | ||
|
||
def show_core_elem | ||
content_tag(:div, id: 'core') do | ||
get_attributes = lambda{|n| { id: "5-#{n}", type: 'core'}} | ||
(1..9).each do |n| | ||
attributes = get_attributes.call(n) | ||
attributes.merge!(onchange: "animeTest1(#{n}, this.value)") unless n == 5 | ||
concat content_tag(:textarea, ' ', attributes) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module WordsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class CoreMandal < ApplicationRecord | ||
belongs_to :user | ||
|
||
has_many :sub_mandals, as: :mandal | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class Mandal < ApplicationRecord | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class SimpleMandal < ApplicationRecord | ||
belongs_to :user | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class SubMandal < ApplicationRecord | ||
belongs_to :mandal, polymorphic: true | ||
|
||
has_many :sub_mandals, as: :mandal | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Word < ApplicationRecord | ||
validates :word, {presence: true, uniqueness: true} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.