class Desktop::JournalListsController < ApplicationController # GET /desktop/journal_lists # GET /desktop/journal_lists.json def index level_types = JournalLevelType.all all_journal_lists = WritingJournal.where(create_user_id: current_user.id) all_journal_lists = all_journal_lists.map do |j| [ j.journal_title, j.journal_level_type_ids.map do |type| level_types.find(type).title end.join(",") ].join(" -- ") end @journal_lists = all_journal_lists.uniq respond_to do |format| format.html { render :layout => false} end end =begin # 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 end