[Logilogi-svn] SF.net SVN: logilogi:[1766] trunk
Status: Beta
Brought to you by:
wybow
|
From: <wy...@us...> - 2010-08-15 22:13:12
|
Revision: 1766
http://logilogi.svn.sourceforge.net/logilogi/?rev=1766&view=rev
Author: wybow
Date: 2010-08-15 22:13:05 +0000 (Sun, 15 Aug 2010)
Log Message:
-----------
Chrome support and logi & remark attach buttons
Modified Paths:
--------------
trunk/app/controllers/annotations_controller.rb
trunk/app/controllers/comments_controller.rb
trunk/app/controllers/logi_inserts_controller.rb
trunk/app/controllers/logis_controller.rb
trunk/app/controllers/perma_links_controller.rb
trunk/app/views/annotations/_new.html.erb
trunk/app/views/layouts/_header.html.erb
trunk/app/views/logis/_comments.html.erb
trunk/app/views/logis/_remarks.html.erb
trunk/app/views/logis/_snippet.html.erb
trunk/app/views/logis/_snippets_list.html.erb
trunk/app/views/logis/_snippets_pagination.html.erb
trunk/app/views/perma_links/_new.html.erb
trunk/app/views/remarks/_list.html.erb
trunk/config/locales/en.yml
trunk/public/stylesheets/logilogi.css
trunk/test/fixtures/remarks.yml
trunk/test/functional/annotations_controller_test.rb
trunk/test/functional/perma_links_controller_test.rb
trunk/test/functional/remarks_controller_test.rb
Added Paths:
-----------
trunk/test/functional/logi_inserts_controller_test.rb
Modified: trunk/app/controllers/annotations_controller.rb
===================================================================
--- trunk/app/controllers/annotations_controller.rb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/controllers/annotations_controller.rb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -22,6 +22,11 @@
### Bodies
def create
+ if params[:insert_remark_id] and !params[:insert_remark_id].empty?
+ @remark = Remark.find(params[:insert_remark_id])
+ else
+ @remark = nil
+ end
new_annotation_position_range_list = self.weave_out_annotations(
params[:body_with_inserts], @logi_version, @logi)
if new_annotation_position_range_list.empty?
@@ -42,12 +47,16 @@
if @logi.errors.empty? and @annotation.valid? and self.thorny_form_free_of_spam?
@annotation.save
+ if @remark and @remark.user == current_user
+ @remark.destroy
+ end
flash[:notice] = t 'c.annotations.added'
if !params[:and_attach] or params[:and_attach].empty?
redirect_to logi_url(@logi)
else
@annotation = Annotation.new
@selected = 'annotation'
+ @remark = nil
render :template => 'logi_inserts/new'
end
else
Modified: trunk/app/controllers/comments_controller.rb
===================================================================
--- trunk/app/controllers/comments_controller.rb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/controllers/comments_controller.rb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -22,7 +22,7 @@
### REST-methods
def new
- @from_blog = (params[:from_blog] ? true : false)
+ @from_blog = (params[:from_blog] == "true" ? true : false)
@selected = params[:selected] || 'new_logi'
@commenting_logi = Logi.new_with(:creator => current_user,
:user_group => current_prefs.user_group)
Modified: trunk/app/controllers/logi_inserts_controller.rb
===================================================================
--- trunk/app/controllers/logi_inserts_controller.rb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/controllers/logi_inserts_controller.rb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -25,6 +25,16 @@
def new
@selected = params[:selected]
@link_selected = params[:link_selected]
+ if params[:insert_remark_id] and !params[:insert_remark_id].empty?
+ @remark = Remark.find(params[:insert_remark_id])
+ @annotation = Annotation.new(:message => @remark.message)
+ else
+ @perma_link = params[:perma_link]
+ if @perma_link
+ @check_link = Link.new_from_s(@perma_link.dup)
+ @check_link.resolve
+ end
+ end
@new_logi = Logi.new_with(:creator => current_user,
:user_group => current_prefs.user_group)
Modified: trunk/app/controllers/logis_controller.rb
===================================================================
--- trunk/app/controllers/logis_controller.rb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/controllers/logis_controller.rb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -258,15 +258,14 @@
def check
@check_link = Link.new_from_s(params[:check_ll_link_string])
@check_link.resolve
- if @check_link.errors.empty?
- respond_to do |format|
- format.js do
- render :template => 'logis/check.js.rjs', :locals => {
- :name => params[:name]}
+ respond_to do |format|
+ format.js do
+ if !@check_link.errors.empty?
+ @check_link = nil
end
+ render :template => 'logis/check.js.rjs', :locals => {
+ :name => params[:name]}
end
- else
- render :nothing => true
end
end
Modified: trunk/app/controllers/perma_links_controller.rb
===================================================================
--- trunk/app/controllers/perma_links_controller.rb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/controllers/perma_links_controller.rb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -37,6 +37,9 @@
flash[:error] = t 'c.perma_links.error_adding'
@selected = 'link'
@link_selected = 'perma_link'
+ @perma_link = params[:perma_link]
+ @check_link = Link.new_from_s(@perma_link.dup)
+ @check_link.resolve
render :template => 'logi_inserts/new'
end
end
Modified: trunk/app/views/annotations/_new.html.erb
===================================================================
--- trunk/app/views/annotations/_new.html.erb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/views/annotations/_new.html.erb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -1,6 +1,7 @@
<% render :layout => 'application/panel', :locals => {
:title => t('v.annotations.adding'), :id => "annotation_panel"} do %>
<label><%= t('v.annotations.annotation_label') %></label>
+ <%= hidden_field_tag :insert_remark_id, (@remark ? @remark.id : nil) %>
<%= text_area :annotation, :message,
: "logiMessagesCheckLength('annotation_message', 'annotation_length_warning')",
: "logiMessagesCheckLength('annotation_message', 'annotation_length_warning')" %>
Modified: trunk/app/views/layouts/_header.html.erb
===================================================================
--- trunk/app/views/layouts/_header.html.erb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/views/layouts/_header.html.erb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -52,18 +52,17 @@
</div>
</div>
</div>
+ <div id="header_box">
<% if !local_assigns[:user_page] %>
- <div id="top_search">
- <% form_for(:search, nil, :url => browse_logis_url(:ll_link_string => ''),
- :html => {:method => :get}) do |form| %>
- <%= form.text_field :ll_link_string, :name => :top_ll_link_string, :value => @query,
- :no_label => true, :id => 'top_search_query' %>
- <%= form.submit t('v.searches.search'), :id => 'top_search_button',
- :class => 'go_button' %>
- <% end %>
- </div>
+ <% form_for(:search, nil, :url => browse_logis_url(:ll_link_string => ''),
+ :html => {:method => :get}) do |form| %>
+ <%= form.submit t('v.searches.search'), :id => 'top_search_button',
+ :class => 'go_button' %>
+ <%= form.text_field :ll_link_string, :name => :top_ll_link_string, :value => @query,
+ :no_label => true, :id => 'top_search_query' %>
+ <% end %>
<% end %>
- <div id="sessions">
+ <div id="header_links">
<% if current_user.anonymous? %>
<%= link_to t('v.layouts.signup'), new_user_url %> |
<%= link_to t('v.layouts.login'), new_user_session_url %><%= (local_assigns[:user_page] ? '' : ' |') %>
@@ -72,6 +71,7 @@
<%= link_to t('v.layouts.preferences'), edit_user_url(current_user) %> |
<%= link_to t('v.layouts.logout'), user_session_path, :method => :delete %><%= (local_assigns[:user_page] ? '' : ' |') %>
<% end %>
+ </div>
</div>
<% if !local_assigns[:tabs_disabled] %>
<%= render :partial => 'layouts/tabs' %>
Modified: trunk/app/views/logis/_comments.html.erb
===================================================================
--- trunk/app/views/logis/_comments.html.erb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/views/logis/_comments.html.erb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -3,5 +3,5 @@
</div>
<% if !logis.empty? %>
<%= render :partial => 'snippets_pagination', :locals => {
- :logis => logis, :selected => 'comments'} %>
+ :logis => logis, :selected => 'comments', :action => :view} %>
<% end %>
Modified: trunk/app/views/logis/_remarks.html.erb
===================================================================
--- trunk/app/views/logis/_remarks.html.erb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/views/logis/_remarks.html.erb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -17,7 +17,7 @@
<%= show_errors 'remark' %>
<%= render :partial => 'remarks/list.html.erb', :locals => {
- :remarks => @remarks} %>
+ :remarks => @remarks, :action => :view} %>
<% javascript_tag do -%>
logiMessagesInitEditor('remark_length_warning',
Modified: trunk/app/views/logis/_snippet.html.erb
===================================================================
--- trunk/app/views/logis/_snippet.html.erb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/views/logis/_snippet.html.erb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -33,12 +33,18 @@
<%= logi.current_snippet %><%= link_to t('v.logis.read_on'),
logi_url(logi.link) %>
</p>
- <div class="spacer"></div>
<% if !logi.untagged? %>
<span class="tags"><em><%= t 'v.logis.tags_label' %></em>
<%= browse_ll_link(logi.link, :step => -1, :length => 78) %>
</span>
<% end %>
+ <% if local_assigns[:action] == :view and
+ !logi.link_matches.collect {|m| m.logi}.include?(@logi) %>
+ <%= button_to(t('v.logis.insert_this_logi'),
+ new_logi_logi_inserts_url(@logi, :selected => 'link', :link_selected => 'perma_link',
+ :perma_link => perma_logi_ll_url(logi)), :class => 'insert_button insert_this_button',
+ :tabindex => 1) %>
+ <% end %>
<div class="spacer"></div>
<% end %>
</div>
Modified: trunk/app/views/logis/_snippets_list.html.erb
===================================================================
--- trunk/app/views/logis/_snippets_list.html.erb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/views/logis/_snippets_list.html.erb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -6,6 +6,7 @@
</center>
<% else %>
<% logis.each do |logi| %>
- <%= render :partial => 'logis/snippet', :locals => {:logi => logi} %>
+ <%= render :partial => 'logis/snippet', :locals => {:logi => logi,
+ :action => local_assigns[:action]} %>
<% end %>
<% end %>
Modified: trunk/app/views/logis/_snippets_pagination.html.erb
===================================================================
--- trunk/app/views/logis/_snippets_pagination.html.erb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/views/logis/_snippets_pagination.html.erb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -8,7 +8,7 @@
<div class="index_list">
<%= render :partial => 'logis/snippets_list', :locals => {
- :logis => logis} %>
+ :logis => logis, :action => local_assigns[:action]} %>
</div>
<%= will_paginate logis, :params => {:selected => selected},
Modified: trunk/app/views/perma_links/_new.html.erb
===================================================================
--- trunk/app/views/perma_links/_new.html.erb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/views/perma_links/_new.html.erb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -1,8 +1,8 @@
<% render :layout => 'application/panel', :locals => {:id => 'link_perma_id'} do %>
<label id="perma_link_label"><%= t 'v.perma_links.permanent_link_label' %></label>
- <%= text_field_tag 'perma_link', nil, :id => "perma_link", :autocomplete => "off" %>
+ <%= text_field_tag 'perma_link', @perma_link, :id => "perma_link", :autocomplete => "off" %>
<%= observe_field 'perma_link', :url => {:controller => 'logis', :action => 'check', :name => 'perma'},
- :method => "get", :with => "check_ll_link_string" %>
+ :method => "get", :frequency => 0.25, :with => "check_ll_link_string" %>
<% end %>
<%= render :partial => 'logis/check', :locals => {:name => 'perma'} %>
Modified: trunk/app/views/remarks/_list.html.erb
===================================================================
--- trunk/app/views/remarks/_list.html.erb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/app/views/remarks/_list.html.erb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -5,6 +5,12 @@
<%= gravatar_for(remark.user, :class => 'avatar') %>
<%= by_author(remark.user, :length => 13) %>
<p><%= remark.message %></p>
+ <% if current_user == remark.user and local_assigns[:action] == :view %>
+ <%= button_to(t('v.logis.insert_this_remark'),
+ new_logi_logi_inserts_url(@logi, :selected => 'annotation',
+ :insert_remark_id => remark.id),
+ :class => 'insert_button insert_this_button', :tabindex => 1) %>
+ <% end %>
<div class="spacer"></div>
</div>
</div>
Modified: trunk/config/locales/en.yml
===================================================================
--- trunk/config/locales/en.yml 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/config/locales/en.yml 2010-08-15 22:13:05 UTC (rev 1766)
@@ -751,8 +751,10 @@
has_different_tagset: "Logi has a different tag-set."
in_depth_response: "Want to give a more in-depth response?"
incoming_to_tags: "Incoming links to tags"
- insert_into: "Attach something to phrase"
+ insert_into: "Attach something to a phrase"
insert_or_remove: "Attach or detach?"
+ insert_this_logi: "Attach this logi to a phrase"
+ insert_this_remark: "Attach as annotation"
like_tree: "Tags are like a location in a tree, start by setting the most important tag above. If no tag is set, the 'Sandbox' tag will be used."
load_editor: "Expand reply editor"
new_for_tags: "Create a new logi for these tags."
Modified: trunk/public/stylesheets/logilogi.css
===================================================================
--- trunk/public/stylesheets/logilogi.css 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/public/stylesheets/logilogi.css 2010-08-15 22:13:05 UTC (rev 1766)
@@ -568,11 +568,12 @@
#header_content {
float: left;
+ width: 35em; /* for Chrome */
padding-top: 0em;
}
#header_content img {
float: left;
- padding: 1em 0 0 1.4em;
+ padding: 0.8em 0 0 1.4em;
margin: -0.15em 0.8em 0em 0.5em;
}
#users_show #header_content img {
@@ -596,7 +597,7 @@
float: left;
clear: left;
font-size: 1.3em;
- margin-bottom: -1em;
+ margin: 0.1em 0em -1em 0em;
word-spacing: 0.1em;
letter-spacing: 0.05em;
font-variant: small-caps;
@@ -610,33 +611,33 @@
font-style: italic;
color: white;
}
-#sessions {
+#header_box {
+}
+#header_links {
float: right;
padding: 0.2em;
- margin-right: 0.4em;
+ margin-right: 0em;
font-size: 1.4em;
color: white;
white-space: nowrap;
}
-#sessions a {
+#header_links a {
border-bottom: solid 1px;
color: white;
border-color: white;
}
#top_search {
- margin-right: 1em;
+}
+#top_search_query {
float: right;
-}
-#top_search #top_search_query {
- margin-top: 0.4em;
- padding: 0.3em;
- float: left;
+ margin: 0.4em 0.5em 0em 0.3em;
+ padding: 0.35em;
width: 8em;
}
-#top_search #top_search_button {
+#top_search_button {
+ float: right;
margin-top: 0.35em;
- margin-left: 0.5em;
- float: left;
+ margin-right: 1em;
}
/* primary tabs, based on the great ala's sliding doors 2 */
@@ -1367,11 +1368,16 @@
width: 6em;
}
.remark p {
- padding-top: 0.8em;
+ padding: 0.8em 0em 0em 0em;
font-size: 1.2em;
line-height: 1.3em;
text-align: left;
}
+.insert_this_button {
+ font-size: 0.7em;
+ margin: 0.5em -0.3em 0em 0em;
+}
+
/* also see logi for remark color */
/* comments */
Modified: trunk/test/fixtures/remarks.yml
===================================================================
--- trunk/test/fixtures/remarks.yml 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/test/fixtures/remarks.yml 2010-08-15 22:13:05 UTC (rev 1766)
@@ -8,6 +8,11 @@
user: john_johnson
message: 'neat, really! this is the way to go'
created_at: <%= 2.days.ago.to_s(:db) %>
+logi_logi_really_nice:
+ logi: logi_logi
+ user_id: <%= User.anonymous.id %>
+ message: 'Really nice!'
+ created_at: <%= 1.day.ago.to_s(:db) %>
michel_foucault_politics_medieval_peter_abelard_economics_did_you_consider:
logi: michel_foucault_politics_medieval_peter_abelard_economics
user: john_johnson
Modified: trunk/test/functional/annotations_controller_test.rb
===================================================================
--- trunk/test/functional/annotations_controller_test.rb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/test/functional/annotations_controller_test.rb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -44,6 +44,23 @@
assert_equal l_v.raw_title.size + 63, ll_annotation.position_ranges.first.last
end
+ def test_create
+ l = logis(:logi_logi)
+ r_nice_id = remarks(:logi_logi_really_nice).id
+ nr_of_r = l.annotations.size
+ l_v = l.current_logi_version
+ b_t = l_v.body
+ l_r = "LL With Super Cow Powers :)"
+ new_b_t = b_t[0...49] + '<a class="selection" target="' + l_r + '">' +
+ b_t[49...63] + "</a>" + b_t[63...-1]
+ post :create, {:ll_link_string => l.link.to_s,
+ :body_with_inserts => new_b_t,
+ :insert_remark_id => r_nice_id}.merge(self.thorny_ok_hash)
+ assert_response :redirect
+ assert_equal nr_of_r + 1, l.annotations.size
+ assert !Remark.find_by_id(r_nice_id)
+ end
+
def test_create_ender
i = logis(:eduard_edison_user)
assert_insert_annotation(i,'Kuku','<p>I am Eduard, ','I have created','.</p>',36,50)
Added: trunk/test/functional/logi_inserts_controller_test.rb
===================================================================
--- trunk/test/functional/logi_inserts_controller_test.rb (rev 0)
+++ trunk/test/functional/logi_inserts_controller_test.rb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -0,0 +1,43 @@
+#--#
+# Copyright: (c) 2006-2009 The LogiLogi Foundation <fou...@lo...>
+#
+# License:
+# This file is part of the LogiLogi program. LogiLogi is Free Software.
+# You can run/distribute/modify LogiLogi under the terms of the GNU Affero
+# General Public License version 3. The Affero GPL states that running a
+# modified version or a derivative work also requires you to make the source
+# code of that work available to everyone that can interact with it. We
+# chose the Affero GPL to ensure that LogiLogi remains open and libre
+# (doc/LICENSE contains the full text of the legally binding license).
+#++#
+
+require File.dirname(__FILE__) + '/../test_helper'
+require 'logi_inserts_controller'
+
+class LogiInsertsControllerTest < ActionController::TestCase
+ fixtures :all
+
+ def setup
+ @controller = LogiInsertsController.new
+ setup_request
+ end
+
+ ### Actions
+
+ # REST-methods
+
+ def test_new
+ get :new, :ll_link_string => logis(:logi_logi).link.to_s
+ assert_response :success
+
+ get :new, :ll_link_string => logis(:logi_logi).link.to_s,
+ :selected => "link", :link_selected => "perma_link",
+ :perma_link => logis(:lubber_sailing).link.to_s
+ assert_response :success
+
+ get :new, :ll_link_string => logis(:logi_logi).link.to_s,
+ :insert_remark_id => remarks(:logi_logi_neat).id.to_s,
+ :selected => "annotation"
+ assert_response :success
+ end
+end
Modified: trunk/test/functional/perma_links_controller_test.rb
===================================================================
--- trunk/test/functional/perma_links_controller_test.rb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/test/functional/perma_links_controller_test.rb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -26,7 +26,6 @@
# REST-methods
-
def test_create
l = logis(:logi_logi)
nr_of_l = l.from_links.size
@@ -39,7 +38,8 @@
b_t[49...63] + "</a>" + b_t[63...-1]
post :create, {:ll_link_string => l.link.to_s,
- :body_with_inserts => new_b_t}.merge(self.thorny_ok_hash)
+ :body_with_inserts => new_b_t,
+ :perma_link => l_l}.merge(self.thorny_ok_hash)
assert_response :redirect
assert_equal nr_of_l + 1, l.from_links.size
@@ -61,7 +61,8 @@
b_t[49...63] + "</a>" + b_t[63...-1]
post :create, {:ll_link_string => l.link.to_s,
- :body_with_inserts => new_b_t}.merge(self.thorny_ok_hash)
+ :body_with_inserts => new_b_t,
+ :perma_link => l_l}.merge(self.thorny_ok_hash)
assert_equal nr_of_l, l.from_links.size # no new link
end
Modified: trunk/test/functional/remarks_controller_test.rb
===================================================================
--- trunk/test/functional/remarks_controller_test.rb 2010-08-15 09:08:14 UTC (rev 1765)
+++ trunk/test/functional/remarks_controller_test.rb 2010-08-15 22:13:05 UTC (rev 1766)
@@ -27,12 +27,14 @@
# REST-methods
def test_create
- assert true
- # TODO
- end
+ l = logis(:logi_logi)
+ nr_of_r = l.remarks.size
- def test_destroy
- assert true
- # TODO
+ post :create, {:ll_link_string => l.link.to_s,
+ :remark => {:message => "Testing remark992"}
+ }.merge(self.thorny_ok_hash)
+
+ assert_response :success
+ assert_equal nr_of_r + 1, l.remarks.size
end
end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|