From 35c1fce8efc8dee8556bfeda5683566a62a21abf Mon Sep 17 00:00:00 2001 From: Fernando Blat Date: Mon, 31 Jan 2011 18:23:15 +0100 Subject: [PATCH] Save state when recently created --- app/models/table.rb | 4 ++++ app/views/admin/tables/show.html.erb | 8 +++++++- spec/acceptance/dashboard_spec.rb | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/models/table.rb b/app/models/table.rb index 7220a25407..0511edc0fa 100644 --- a/app/models/table.rb +++ b/app/models/table.rb @@ -115,6 +115,10 @@ class Table < Sequel::Model(:user_tables) save_changes end + def pending_to_save? + self.name =~ /^untitle_table/ + end + # TODO: use the database field def rows_counted owner.in_database do |user_database| diff --git a/app/views/admin/tables/show.html.erb b/app/views/admin/tables/show.html.erb index d5d1acff31..efaa349a9e 100644 --- a/app/views/admin/tables/show.html.erb +++ b/app/views/admin/tables/show.html.erb @@ -10,7 +10,13 @@

<%= @table.name %>

-

<%= table_privacy_text(@table) %>

+

+ <% if @table.pending_to_save? %> + SAVE + <% else %> + <%= table_privacy_text(@table) %> + <% end %> +

<% unless @table.tags.blank? %> <% @table.tags.split(',').each do |tag_name| %> diff --git a/spec/acceptance/dashboard_spec.rb b/spec/acceptance/dashboard_spec.rb index 7ce5f964da..4f493fe0b2 100644 --- a/spec/acceptance/dashboard_spec.rb +++ b/spec/acceptance/dashboard_spec.rb @@ -269,7 +269,7 @@ feature "Dashboard", %q{ page.find('div.create_window span.bottom input#create_table').click page.should have_css("h2", :text => 'untitle_table') - page.should have_css("p.status", :text => 'PUBLIC') + page.should have_css("p.status a.save", :text => 'SAVE') end end