-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
241 additions
and
9 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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
class AccountController < ApplicationController | ||
before_filter :login_required | ||
before_filter :user_info | ||
before_filter :notebooks_info | ||
|
||
layout 'main' | ||
|
||
def index | ||
|
||
end | ||
|
||
def notebooks | ||
@notebooks = User.find(session[:user_id]).notebooks | ||
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
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,66 @@ | ||
class NotebookController < ApplicationController | ||
|
||
before_filter :login_required | ||
before_filter :user_info | ||
before_filter :notebooks_info | ||
|
||
before_filter :notebook_info, :except => [:index, :new, :create] | ||
|
||
layout 'main' | ||
|
||
def notebook_info | ||
@notebook = Notebook.find(params[:id]) | ||
end | ||
|
||
def index | ||
end | ||
|
||
def show | ||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.xml { render :xml => @notebook } | ||
end | ||
end | ||
|
||
def new | ||
@notebook = Notebook.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.xml { render :xml => @notebook } | ||
end | ||
end | ||
|
||
def create | ||
@notebook = Notebook.new(params[:notebook]) | ||
@notebook.creator = @user | ||
|
||
respond_to do |format| | ||
if @notebook.save | ||
flash[:notice] = 'Notebook was successfully created.' | ||
format.html { redirect_to(@notebook) } | ||
format.xml { render :xml => @notebook, :status => :created, :location => @notebook } | ||
else | ||
format.html { render :action => "new" } | ||
format.xml { render :xml => @notebook.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
def edit | ||
end | ||
|
||
def update | ||
respond_to do |format| | ||
if @notebook.update_attributes(params[:notebook]) | ||
flash[:notice] = 'Panel was successfully updated.' | ||
format.html { redirect_to(@notebook) } | ||
format.xml { head :ok } | ||
else | ||
format.html { render :action => "edit" } | ||
format.xml { render :xml => @notebook.errors, :status => :unprocessable_entity } | ||
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
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 NotebookHelper | ||
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,3 +0,0 @@ | ||
- for notebook in @notebooks | ||
%li | ||
%a{:href=> "/notebook/notebook.name"}=notebook.name | ||
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,28 @@ | ||
#sidebar | ||
= render_component :controller => 'account', :action => 'notebooks' | ||
!!! | ||
%html | ||
%head | ||
%link{ :rel => "shortcut icon", :href => "/favicon.ico", :type => "image/x-icon"}/ | ||
%title= controller.controller_name.capitalize | ||
= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' | ||
= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js' | ||
= javascript_include_tag 'jquery.editinplace.packed' | ||
= javascript_include_tag 'main' | ||
= stylesheet_link_tag 'main' | ||
|
||
%body | ||
|
||
#container | ||
|
||
#header | ||
#account | ||
%a{:href => "/account"}=@user.name | ||
|
||
#sidebar | ||
%a{:href => "/notebook/new"} new | ||
%ul#notebooks | ||
- for notebook in @notebooks | ||
%li{:class => ( ! @notebook.nil? and @notebook.id == notebook.id ? 'selected' : '' )} | ||
%a{:href => "/notebook/show/#{notebook.id}"}=notebook.name | ||
|
||
#main | ||
= yield |
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,14 @@ | ||
-form_for @notebook do |f| | ||
|
||
%p | ||
= f.error_messages | ||
|
||
%p | ||
=f.text_field :name | ||
|
||
%p | ||
=f.text_area :content | ||
|
||
%p | ||
= submit_tag 'save' | ||
|
Empty file.
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,13 @@ | ||
-form_for @notebook, :url => { :action => "create" } do |f| | ||
|
||
= f.error_messages | ||
|
||
%p | ||
=f.text_field :name | ||
|
||
%p | ||
=f.text_area :content | ||
|
||
%p | ||
= submit_tag 'save' | ||
|
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,6 @@ | ||
%h2=@notebook.name | ||
|
||
%a{:href => "/notebook/edit/#{@notebook.id}"} edit | ||
|
||
#notebook_content | ||
=@notebook.content |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
html { | ||
margin: 0; | ||
padding: 0; } | ||
|
||
body { | ||
margin: 0; | ||
padding: 0; | ||
font: 14px Arial,Verdana,Helvetica,sans-serif; | ||
background-color: #eee; | ||
color: #000; } | ||
|
||
ul { | ||
list-style: none; | ||
padding: 0 0 0 10px; } | ||
|
||
#container { | ||
padding: 10px; } | ||
#container #account { | ||
text-align: right; } | ||
#container #sidebar { | ||
float: left; | ||
width: 200px; | ||
height: 100%; | ||
padding: 1px 5px 1px 1px; | ||
margin-right: 10px; } | ||
#container #sidebar #notebooks li { | ||
padding: 2px 3px 4px 5px; } | ||
#container #sidebar #notebooks li.selected { | ||
background-color: #ccf; } | ||
#container #main { | ||
float: left; } |
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,37 @@ | ||
html | ||
:margin 0 | ||
:padding 0 | ||
|
||
body | ||
:margin 0 | ||
:padding 0 | ||
:font 14px Arial,Verdana,Helvetica,sans-serif | ||
:background-color #eee | ||
:color #000 | ||
|
||
ul | ||
:list-style none | ||
:padding 0 0 0 10px | ||
|
||
#container | ||
:padding 10px | ||
|
||
#account | ||
:text-align right | ||
|
||
#sidebar | ||
:float left | ||
:width 200px | ||
:height 100% | ||
:padding 1px 5px 1px 1px | ||
:margin-right 10px | ||
|
||
#notebooks | ||
li | ||
:padding 2px 3px 4px 5px | ||
li.selected | ||
:background-color #ccf | ||
|
||
#main | ||
:float left | ||
|
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,8 @@ | ||
require 'test_helper' | ||
|
||
class NotebookControllerTest < ActionController::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
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,4 @@ | ||
require 'test_helper' | ||
|
||
class NotebookHelperTest < ActionView::TestCase | ||
end |