add journal list template
This commit is contained in:
parent
e2da22b29c
commit
5a9d9151d9
|
@ -0,0 +1,83 @@
|
||||||
|
class Desktop::JournalListsController < ApplicationController
|
||||||
|
# GET /desktop/journal_lists
|
||||||
|
# GET /desktop/journal_lists.json
|
||||||
|
def index
|
||||||
|
@desktop_journal_lists = Desktop::JournalList.all
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
format.json { render json: @desktop_journal_lists }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /desktop/journal_lists/1
|
||||||
|
# GET /desktop/journal_lists/1.json
|
||||||
|
def show
|
||||||
|
@desktop_journal_list = Desktop::JournalList.find(params[:id])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # show.html.erb
|
||||||
|
format.json { render json: @desktop_journal_list }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /desktop/journal_lists/new
|
||||||
|
# GET /desktop/journal_lists/new.json
|
||||||
|
def new
|
||||||
|
@desktop_journal_list = Desktop::JournalList.new
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.json { render json: @desktop_journal_list }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /desktop/journal_lists/1/edit
|
||||||
|
def edit
|
||||||
|
@desktop_journal_list = Desktop::JournalList.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /desktop/journal_lists
|
||||||
|
# POST /desktop/journal_lists.json
|
||||||
|
def create
|
||||||
|
@desktop_journal_list = Desktop::JournalList.new(params[:desktop_journal_list])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @desktop_journal_list.save
|
||||||
|
format.html { redirect_to @desktop_journal_list, notice: 'Journal list was successfully created.' }
|
||||||
|
format.json { render json: @desktop_journal_list, status: :created, location: @desktop_journal_list }
|
||||||
|
else
|
||||||
|
format.html { render action: "new" }
|
||||||
|
format.json { render json: @desktop_journal_list.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PUT /desktop/journal_lists/1
|
||||||
|
# PUT /desktop/journal_lists/1.json
|
||||||
|
def update
|
||||||
|
@desktop_journal_list = Desktop::JournalList.find(params[:id])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @desktop_journal_list.update_attributes(params[:desktop_journal_list])
|
||||||
|
format.html { redirect_to @desktop_journal_list, notice: 'Journal list was successfully updated.' }
|
||||||
|
format.json { head :ok }
|
||||||
|
else
|
||||||
|
format.html { render action: "edit" }
|
||||||
|
format.json { render json: @desktop_journal_list.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /desktop/journal_lists/1
|
||||||
|
# DELETE /desktop/journal_lists/1.json
|
||||||
|
def destroy
|
||||||
|
@desktop_journal_list = Desktop::JournalList.find(params[:id])
|
||||||
|
@desktop_journal_list.destroy
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to desktop_journal_lists_url }
|
||||||
|
format.json { head :ok }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module Desktop::JournalListsHelper
|
||||||
|
end
|
|
@ -0,0 +1,17 @@
|
||||||
|
<%= form_for(@desktop_journal_list) do |f| %>
|
||||||
|
<% if @desktop_journal_list.errors.any? %>
|
||||||
|
<div id="error_explanation">
|
||||||
|
<h2><%= pluralize(@desktop_journal_list.errors.count, "error") %> prohibited this desktop_journal_list from being saved:</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% @desktop_journal_list.errors.full_messages.each do |msg| %>
|
||||||
|
<li><%= msg %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<h1>Editing desktop_journal_list</h1>
|
||||||
|
|
||||||
|
<%= render 'form' %>
|
||||||
|
|
||||||
|
<%= link_to 'Show', @desktop_journal_list %> |
|
||||||
|
<%= link_to 'Back', desktop_journal_lists_path %>
|
|
@ -0,0 +1,21 @@
|
||||||
|
<h1>Listing desktop_journal_lists</h1>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% @desktop_journal_lists.each do |desktop_journal_list| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to 'Show', desktop_journal_list %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_desktop_journal_list_path(desktop_journal_list) %></td>
|
||||||
|
<td><%= link_to 'Destroy', desktop_journal_list, confirm: 'Are you sure?', method: :delete %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<%= link_to 'New Journal list', new_desktop_journal_list_path %>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<h1>New desktop_journal_list</h1>
|
||||||
|
|
||||||
|
<%= render 'form' %>
|
||||||
|
|
||||||
|
<%= link_to 'Back', desktop_journal_lists_path %>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
|
|
||||||
|
<%= link_to 'Edit', edit_desktop_journal_list_path(@desktop_journal_list) %> |
|
||||||
|
<%= link_to 'Back', desktop_journal_lists_path %>
|
|
@ -0,0 +1,164 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
||||||
|
# It demonstrates how one might use RSpec to specify the controller code that
|
||||||
|
# was generated by Rails when you ran the scaffold generator.
|
||||||
|
#
|
||||||
|
# It assumes that the implementation code is generated by the rails scaffold
|
||||||
|
# generator. If you are using any extension libraries to generate different
|
||||||
|
# controller code, this generated spec may or may not pass.
|
||||||
|
#
|
||||||
|
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
||||||
|
# of tools you can use to make these specs even more expressive, but we're
|
||||||
|
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
||||||
|
#
|
||||||
|
# Compared to earlier versions of this generator, there is very limited use of
|
||||||
|
# stubs and message expectations in this spec. Stubs are only used when there
|
||||||
|
# is no simpler way to get a handle on the object needed for the example.
|
||||||
|
# Message expectations are only used when there is no simpler way to specify
|
||||||
|
# that an instance is receiving a specific message.
|
||||||
|
|
||||||
|
describe Desktop::JournalListsController do
|
||||||
|
|
||||||
|
# This should return the minimal set of attributes required to create a valid
|
||||||
|
# Desktop::JournalList. As you add validations to Desktop::JournalList, be sure to
|
||||||
|
# update the return value of this method accordingly.
|
||||||
|
def valid_attributes
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
|
# This should return the minimal set of values that should be in the session
|
||||||
|
# in order to pass any filters (e.g. authentication) defined in
|
||||||
|
# Desktop::JournalListsController. Be sure to keep this updated too.
|
||||||
|
def valid_session
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET index" do
|
||||||
|
it "assigns all desktop_journal_lists as @desktop_journal_lists" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
get :index, {}, valid_session
|
||||||
|
assigns(:desktop_journal_lists).should eq([journal_list])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET show" do
|
||||||
|
it "assigns the requested desktop_journal_list as @desktop_journal_list" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
get :show, {:id => journal_list.to_param}, valid_session
|
||||||
|
assigns(:desktop_journal_list).should eq(journal_list)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET new" do
|
||||||
|
it "assigns a new desktop_journal_list as @desktop_journal_list" do
|
||||||
|
get :new, {}, valid_session
|
||||||
|
assigns(:desktop_journal_list).should be_a_new(Desktop::JournalList)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "GET edit" do
|
||||||
|
it "assigns the requested desktop_journal_list as @desktop_journal_list" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
get :edit, {:id => journal_list.to_param}, valid_session
|
||||||
|
assigns(:desktop_journal_list).should eq(journal_list)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "POST create" do
|
||||||
|
describe "with valid params" do
|
||||||
|
it "creates a new Desktop::JournalList" do
|
||||||
|
expect {
|
||||||
|
post :create, {:desktop_journal_list => valid_attributes}, valid_session
|
||||||
|
}.to change(Desktop::JournalList, :count).by(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "assigns a newly created desktop_journal_list as @desktop_journal_list" do
|
||||||
|
post :create, {:desktop_journal_list => valid_attributes}, valid_session
|
||||||
|
assigns(:desktop_journal_list).should be_a(Desktop::JournalList)
|
||||||
|
assigns(:desktop_journal_list).should be_persisted
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the created desktop_journal_list" do
|
||||||
|
post :create, {:desktop_journal_list => valid_attributes}, valid_session
|
||||||
|
response.should redirect_to(Desktop::JournalList.last)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "with invalid params" do
|
||||||
|
it "assigns a newly created but unsaved desktop_journal_list as @desktop_journal_list" do
|
||||||
|
# Trigger the behavior that occurs when invalid params are submitted
|
||||||
|
Desktop::JournalList.any_instance.stub(:save).and_return(false)
|
||||||
|
post :create, {:desktop_journal_list => {}}, valid_session
|
||||||
|
assigns(:desktop_journal_list).should be_a_new(Desktop::JournalList)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "re-renders the 'new' template" do
|
||||||
|
# Trigger the behavior that occurs when invalid params are submitted
|
||||||
|
Desktop::JournalList.any_instance.stub(:save).and_return(false)
|
||||||
|
post :create, {:desktop_journal_list => {}}, valid_session
|
||||||
|
response.should render_template("new")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "PUT update" do
|
||||||
|
describe "with valid params" do
|
||||||
|
it "updates the requested desktop_journal_list" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
# Assuming there are no other desktop_journal_lists in the database, this
|
||||||
|
# specifies that the Desktop::JournalList created on the previous line
|
||||||
|
# receives the :update_attributes message with whatever params are
|
||||||
|
# submitted in the request.
|
||||||
|
Desktop::JournalList.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
|
||||||
|
put :update, {:id => journal_list.to_param, :desktop_journal_list => {'these' => 'params'}}, valid_session
|
||||||
|
end
|
||||||
|
|
||||||
|
it "assigns the requested desktop_journal_list as @desktop_journal_list" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
put :update, {:id => journal_list.to_param, :desktop_journal_list => valid_attributes}, valid_session
|
||||||
|
assigns(:desktop_journal_list).should eq(journal_list)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the desktop_journal_list" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
put :update, {:id => journal_list.to_param, :desktop_journal_list => valid_attributes}, valid_session
|
||||||
|
response.should redirect_to(journal_list)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "with invalid params" do
|
||||||
|
it "assigns the desktop_journal_list as @desktop_journal_list" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
# Trigger the behavior that occurs when invalid params are submitted
|
||||||
|
Desktop::JournalList.any_instance.stub(:save).and_return(false)
|
||||||
|
put :update, {:id => journal_list.to_param, :desktop_journal_list => {}}, valid_session
|
||||||
|
assigns(:desktop_journal_list).should eq(journal_list)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "re-renders the 'edit' template" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
# Trigger the behavior that occurs when invalid params are submitted
|
||||||
|
Desktop::JournalList.any_instance.stub(:save).and_return(false)
|
||||||
|
put :update, {:id => journal_list.to_param, :desktop_journal_list => {}}, valid_session
|
||||||
|
response.should render_template("edit")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "DELETE destroy" do
|
||||||
|
it "destroys the requested desktop_journal_list" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
expect {
|
||||||
|
delete :destroy, {:id => journal_list.to_param}, valid_session
|
||||||
|
}.to change(Desktop::JournalList, :count).by(-1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the desktop_journal_lists list" do
|
||||||
|
journal_list = Desktop::JournalList.create! valid_attributes
|
||||||
|
delete :destroy, {:id => journal_list.to_param}, valid_session
|
||||||
|
response.should redirect_to(desktop_journal_lists_url)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
# Specs in this file have access to a helper object that includes
|
||||||
|
# the Desktop::JournalListsHelper. For example:
|
||||||
|
#
|
||||||
|
# describe Desktop::JournalListsHelper do
|
||||||
|
# describe "string concat" do
|
||||||
|
# it "concats two strings with spaces" do
|
||||||
|
# helper.concat_strings("this","that").should == "this that"
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
describe Desktop::JournalListsHelper do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "Desktop::JournalLists" do
|
||||||
|
describe "GET /desktop_journal_lists" do
|
||||||
|
it "works! (now write some real specs)" do
|
||||||
|
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
|
||||||
|
get desktop_journal_lists_path
|
||||||
|
response.status.should be(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,35 @@
|
||||||
|
require "spec_helper"
|
||||||
|
|
||||||
|
describe Desktop::JournalListsController do
|
||||||
|
describe "routing" do
|
||||||
|
|
||||||
|
it "routes to #index" do
|
||||||
|
get("/desktop/journal_lists").should route_to("desktop/journal_lists#index")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #new" do
|
||||||
|
get("/desktop/journal_lists/new").should route_to("desktop/journal_lists#new")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #show" do
|
||||||
|
get("/desktop/journal_lists/1").should route_to("desktop/journal_lists#show", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #edit" do
|
||||||
|
get("/desktop/journal_lists/1/edit").should route_to("desktop/journal_lists#edit", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #create" do
|
||||||
|
post("/desktop/journal_lists").should route_to("desktop/journal_lists#create")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #update" do
|
||||||
|
put("/desktop/journal_lists/1").should route_to("desktop/journal_lists#update", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #destroy" do
|
||||||
|
delete("/desktop/journal_lists/1").should route_to("desktop/journal_lists#destroy", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "desktop/journal_lists/edit" do
|
||||||
|
before(:each) do
|
||||||
|
@desktop_journal_list = assign(:desktop_journal_list, stub_model(Desktop::JournalList))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders the edit desktop_journal_list form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||||
|
assert_select "form", :action => desktop_journal_lists_path(@desktop_journal_list), :method => "post" do
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "desktop/journal_lists/index" do
|
||||||
|
before(:each) do
|
||||||
|
assign(:desktop_journal_lists, [
|
||||||
|
stub_model(Desktop::JournalList),
|
||||||
|
stub_model(Desktop::JournalList)
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders a list of desktop/journal_lists" do
|
||||||
|
render
|
||||||
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "desktop/journal_lists/new" do
|
||||||
|
before(:each) do
|
||||||
|
assign(:desktop_journal_list, stub_model(Desktop::JournalList).as_new_record)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders new desktop_journal_list form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||||
|
assert_select "form", :action => desktop_journal_lists_path, :method => "post" do
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "desktop/journal_lists/show" do
|
||||||
|
before(:each) do
|
||||||
|
@desktop_journal_list = assign(:desktop_journal_list, stub_model(Desktop::JournalList))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders attributes in <p>" do
|
||||||
|
render
|
||||||
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue