From 32b1ab88cbd74bf2147731cc0c7e6c8db95fc540 Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Sat, 29 Mar 2014 16:48:54 +0100 Subject: added basic scaffold for pois --- app/views/pois/_form.html.erb | 31 +++++++++++++++++++++++++++++++ app/views/pois/edit.html.erb | 6 ++++++ app/views/pois/index.html.erb | 31 +++++++++++++++++++++++++++++++ app/views/pois/index.json.jbuilder | 4 ++++ app/views/pois/new.html.erb | 5 +++++ app/views/pois/show.html.erb | 19 +++++++++++++++++++ app/views/pois/show.json.jbuilder | 1 + 7 files changed, 97 insertions(+) create mode 100644 app/views/pois/_form.html.erb create mode 100644 app/views/pois/edit.html.erb create mode 100644 app/views/pois/index.html.erb create mode 100644 app/views/pois/index.json.jbuilder create mode 100644 app/views/pois/new.html.erb create mode 100644 app/views/pois/show.html.erb create mode 100644 app/views/pois/show.json.jbuilder (limited to 'app/views') diff --git a/app/views/pois/_form.html.erb b/app/views/pois/_form.html.erb new file mode 100644 index 0000000..26db79d --- /dev/null +++ b/app/views/pois/_form.html.erb @@ -0,0 +1,31 @@ +<%= form_for(@poi) do |f| %> + <% if @poi.errors.any? %> +
+

<%= pluralize(@poi.errors.count, "error") %> prohibited this poi from being saved:

+ + +
+ <% end %> + +
+ +
+ <%= f.label :message %>
+ <%= f.text_area :message %> +
+
+ <%= f.label :lat %>
+ <%= f.text_field :lat %> +
+
+ <%= f.label :lon %>
+ <%= f.text_field :lon %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/pois/edit.html.erb b/app/views/pois/edit.html.erb new file mode 100644 index 0000000..71dd920 --- /dev/null +++ b/app/views/pois/edit.html.erb @@ -0,0 +1,6 @@ +

Editing poi

+ +<%= render 'form' %> + +<%= link_to 'Show', @poi %> | +<%= link_to 'Back', pois_path %> diff --git a/app/views/pois/index.html.erb b/app/views/pois/index.html.erb new file mode 100644 index 0000000..0e1d1d1 --- /dev/null +++ b/app/views/pois/index.html.erb @@ -0,0 +1,31 @@ +

Listing pois

+ + + + + + + + + + + + + + + <% @pois.each do |poi| %> + + + + + + + + + <% end %> + +
MessageLatLon
<%= poi.message %><%= poi.lat %><%= poi.lon %><%= link_to 'Show', poi %><%= link_to 'Edit', edit_poi_path(poi) %><%= link_to 'Destroy', poi, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Poi', new_poi_path %> diff --git a/app/views/pois/index.json.jbuilder b/app/views/pois/index.json.jbuilder new file mode 100644 index 0000000..c0f24fe --- /dev/null +++ b/app/views/pois/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@pois) do |poi| + json.extract! poi, :id, :message, :lat, :lon + json.url poi_url(poi, format: :json) +end diff --git a/app/views/pois/new.html.erb b/app/views/pois/new.html.erb new file mode 100644 index 0000000..ea4ebe0 --- /dev/null +++ b/app/views/pois/new.html.erb @@ -0,0 +1,5 @@ +

New poi

+ +<%= render 'form' %> + +<%= link_to 'Back', pois_path %> diff --git a/app/views/pois/show.html.erb b/app/views/pois/show.html.erb new file mode 100644 index 0000000..77fdf0b --- /dev/null +++ b/app/views/pois/show.html.erb @@ -0,0 +1,19 @@ +

<%= notice %>

+ +

+ Message: + <%= @poi.message %> +

+ +

+ Lat: + <%= @poi.lat %> +

+ +

+ Lon: + <%= @poi.lon %> +

+ +<%= link_to 'Edit', edit_poi_path(@poi) %> | +<%= link_to 'Back', pois_path %> diff --git a/app/views/pois/show.json.jbuilder b/app/views/pois/show.json.jbuilder new file mode 100644 index 0000000..5f4cf05 --- /dev/null +++ b/app/views/pois/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @poi, :id, :message, :lat, :lon, :created_at, :updated_at -- cgit v1.2.1