-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User와 Notice, post 모델 관계 설정 1:N 및 edit, update기능 추가 및 예외처리
- Loading branch information
Showing
17 changed files
with
120 additions
and
37 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,3 +1,3 @@ | ||
CKEDITOR.editorConfig = function( config ) { | ||
config.enterMode = CKEDITOR.ENTER_BR; | ||
} | ||
// CKEDITOR.editorConfig = function( config ) { | ||
// config.enterMode = CKEDITOR.ENTER_BR; | ||
// } |
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class Post < ActiveRecord::Base | ||
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
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,15 @@ | ||
<div style="padding:10px"></div> | ||
|
||
<div class="row"> | ||
<div class="col-xs-12 col-sm-8 col-sm-offeset-2 col-md-8 col-md-offset-2"> | ||
<%= form_for :freeboard, class: "form-control", url: freeboard_path(@freeboard), method: "patch" do |f| %> | ||
<%= f.text_field :title , class: "form-control", :required => true, autofocus: true %> | ||
<%= f.text_field :author, class: "form-control" %> | ||
<!-- <%= f.text_area :content, size: "25x4" , class: "form-control" , placeholder: "내용" %> --> | ||
<%= f.cktext_area :content, rows: 10 %> | ||
<div class="pull-right" style="margin-top:3px"> | ||
<%= f.submit "제출", class: "btn btn-default" %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> |
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,7 +1,13 @@ | ||
<%= form_for @freeboard, class: "form-control", url: {action: "create"} do |f| %> | ||
<%= f.text_field :title , class: "form-control", placeholder: "타이틀", :required => true, autofocus: true %> | ||
<%= f.text_field :author, class: "form-control", placeholder: "작성자" %> | ||
<!-- <%= f.text_area :content, size: "25x4" , class: "form-control" , placeholder: "내용" %> --> | ||
<%= f.cktext_area :content, rows: 10 %> | ||
<%= f.submit "제출", class: "btn btn-default" %> | ||
<% end %> | ||
<div class="row"> | ||
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-8 col-md-offeset-2"> | ||
<%= form_for :freeboard, class: "form-control", url: {action: "create"} do |f| %> | ||
<%= f.text_field :title , class: "form-control", placeholder: "타이틀", :required => true, autofocus: true %> | ||
<%= f.text_field :author, class: "form-control", placeholder: "작성자" %> | ||
<%= f.cktext_area :content, rows: 10 %> | ||
<%= hidden_field_tag(:user_id, current_user.id) %> | ||
<div class="pull-rigth"> | ||
<%= f.submit "제출", class: "btn btn-default" %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> |
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,13 +1,32 @@ | ||
<% if flash[:notice] %> | ||
<div class="notice"> | ||
<div class="alert alert-success alert-dismissible" role="alert"> | ||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<%= flash[:notice] %> | ||
<div style="padding:20px"> </div> | ||
|
||
<div class="row"> | ||
<% if flash[:notice] %> | ||
<div class="notice"> | ||
<div class="alert alert-success alert-dismissible" role="alert"> | ||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<%= flash[:notice] %> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
|
||
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<h3 class="panel-title"><%= raw @freeboard.title %></h3> | ||
</div> | ||
<div class="panel-body"> | ||
<%= raw @freeboard.content %> | ||
</div> | ||
</div> | ||
<% if current_user.id == @freeboard.user_id %> | ||
<div class="pull-right"> | ||
<%= link_to("Edit", edit_freeboard_path(@freeboard), class: "btn btn-default") %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
|
||
<div style="padding:30px"> </div> | ||
<div style="padding:90px;"> </div> |
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,15 @@ | ||
<div style="padding:10px"></div> | ||
|
||
<div class="row"> | ||
<div class="col-xs-12 col-sm-8 col-sm-offeset-2 col-md-8 col-md-offset-2"> | ||
<%= form_for :post, class: "form-control", url: freeboard_path(@post), method: "patch" do |f| %> | ||
<%= f.text_field :title , class: "form-control", :required => true, autofocus: true %> | ||
<%= f.text_field :author, class: "form-control" %> | ||
<!-- <%= f.text_area :content, size: "25x4" , class: "form-control" , placeholder: "내용" %> --> | ||
<%= f.cktext_area :content, rows: 10 %> | ||
<div class="pull-right" style="margin-top:3px"> | ||
<%= f.submit "제출", class: "btn btn-default" %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> |
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
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
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