Class: DataEntriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/data_entries_controller.rb

Instance Method Summary collapse

Methods included from Zena::App

included

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/data_entries_controller.rb', line 13

def create
  @data_entry = secure!(Node) { DataEntry.create_data_entry(params['data_entry']) }

  respond_to do |format|
    if @data_entry.errors.empty?
      flash.now[:notice] = _('Data entry was successfully created.')
      format.html { redirect_to data_entry_url(@data_entry) }
      format.js
      format.xml  { head :created, :location => data_entry_url(@data_entry) }
    else
      format.html { render :action => "new" }
      format.js
      format.xml  { render :xml => @data_entry.errors.to_xml }
    end
  end
end

#destroyObject



55
56
57
58
59
60
61
62
63
# File 'app/controllers/data_entries_controller.rb', line 55

def destroy
  @data_entry.destroy

  respond_to do |format|
    format.html { redirect_to zen_path(@node) }
    format.js
    format.xml  { head :ok }
  end
end

#editObject

modifications of the node itself (dates, groups, revert editions, etc)



37
38
39
40
41
42
43
44
# File 'app/controllers/data_entries_controller.rb', line 37

def edit
  respond_to do |format|
    format.js do
      # zafu edit
      render :template => 'data_entries/edit.rjs' # FIXME: this should not be needed. Rails bug ?
    end
  end
end

#newObject



9
10
11
# File 'app/controllers/data_entries_controller.rb', line 9

def new
  # TODO
end

#showObject



6
7
# File 'app/controllers/data_entries_controller.rb', line 6

def show
end

#updateObject



46
47
48
49
50
51
52
53
# File 'app/controllers/data_entries_controller.rb', line 46

def update
  @data_entry.update_attributes_with_transformation(params[:data_entry])

  respond_to do |format|
    format.html # TODO
    format.js
  end
end

#zafuObject



30
31
32
33
34
# File 'app/controllers/data_entries_controller.rb', line 30

def zafu
  respond_to do |format|
    format.js { render :action => 'show' }
  end
end