[Logilogi-svn] SF.net SVN: logilogi:[1725] trunk
Status: Beta
Brought to you by:
wybow
|
From: <wy...@us...> - 2010-06-21 14:07:47
|
Revision: 1725
http://logilogi.svn.sourceforge.net/logilogi/?rev=1725&view=rev
Author: wybow
Date: 2010-06-21 14:07:40 +0000 (Mon, 21 Jun 2010)
Log Message:
-----------
All tests working now, will now do changes page
Modified Paths:
--------------
trunk/app/controllers/annotations_controller.rb
trunk/app/controllers/application_controller.rb
trunk/app/controllers/comments_controller.rb
trunk/app/controllers/external_links_controller.rb
trunk/app/controllers/linked_logis_controller.rb
trunk/app/controllers/links_controller.rb
trunk/app/controllers/logi_extras_controller.rb
trunk/app/controllers/logi_inserts_controller.rb
trunk/app/controllers/logi_versions_controller.rb
trunk/app/controllers/logis_controller.rb
trunk/app/controllers/perma_links_controller.rb
trunk/app/controllers/ratings_controller.rb
trunk/app/controllers/remarks_controller.rb
trunk/app/controllers/votes_controller.rb
trunk/app/helpers/application_helper.rb
trunk/app/models/context.rb
trunk/app/models/link.rb
trunk/app/views/layouts/_tabs.html.erb
trunk/app/views/logis/_clear_button.html.erb
trunk/app/views/logis/_navigation_bar_browse.html.erb
trunk/app/views/logis/_navigation_bar_edit.html.erb
trunk/app/views/logis/_navigation_bar_new.html.erb
trunk/app/views/logis/_side_menu.html.erb
trunk/app/views/logis/_tag_list.html.erb
trunk/app/views/logis/edit.html.erb
trunk/app/views/logis/index.html.erb
trunk/app/views/logis/index_new_edit.js.rjs
trunk/app/views/logis/new.html.erb
trunk/config/locales/en.yml
trunk/db/schema.rb
trunk/lib/modules/tags_strings_module.rb
trunk/test/fixtures/link_matches.yml
trunk/test/fixtures/links.yml
trunk/test/functional/logis_controller_test.rb
trunk/test/functional/perma_links_controller_test.rb
trunk/test/test_helper.rb
trunk/test/unit/context_test.rb
trunk/test/unit/link_test.rb
Added Paths:
-----------
trunk/db/migrate/20100614144931_tagless_links.rb
Removed Paths:
-------------
trunk/app/controllers/logi_settings_controller.rb
trunk/app/views/logi_settings/
trunk/test/functional/logi_settings_controller_test.rb
trunk/test/functional/main_page_controller_test.rb
trunk/test/functional/searches_controller_test.rb
Modified: trunk/app/controllers/annotations_controller.rb
===================================================================
--- trunk/app/controllers/annotations_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/annotations_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -16,7 +16,7 @@
### Filters
- before_filter :resolve_context, :page_name, :find_logi_and_logi_version,
+ before_filter :page_name, :find_logi_and_logi_version,
:except => :index
### Bodies
Modified: trunk/app/controllers/application_controller.rb
===================================================================
--- trunk/app/controllers/application_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/application_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -29,9 +29,10 @@
filter_parameter_logging :password, :password_confirmation
helper_method :current_user_session, :current_user
+
before_filter :set_locale, :append_return_url,
:redirect_if_wrong_subdomain, :current_prefs,
- :page_id_and_class
+ :page_id_and_class, :resolve_context
### Bodies
@@ -134,7 +135,7 @@
else
options = extra_options.merge(options)
end
- if !current_context.nil?
+ if current_context.link?
options[:ll_link_string] ||= current_context.link.to_s(
#{link_options})
else
@@ -637,27 +638,30 @@
# Resolves the current context.
#
def resolve_context
+ context_link_string = not_empty(params[:new_ll_link_string])
if params[:top_ll_link_string]
- params[:ll_link_string] = params[:top_ll_link_string].gsub(' ','/')
+ context_link_string ||= not_empty(
+ params[:top_ll_link_string].gsub(' ','/'))
end
- params[:ll_link_string] = params[:new_ll_link_string] if params[:new_ll_link_string]
- if params[:ll_link_string] and !params[:ll_link_string].empty?
- context_link_string = params[:ll_link_string]
- end
+ context_link_string ||= not_empty(params[:ll_link_string])
if params[:controller] == "logis" and
(params[:action] == "new" or params[:action] == "edit")
force = true
- if context_link_string.split('/')[0] == Tag.sandbox.to_s
- context_link_string = nil
- end
+ replace_tag_string = Tag.sandbox.to_s
else
force = params[:force]
+ replace_tag_string = nil
end
- if context_link_string
- self.current_context = Context.new(
- context_link_string, :force => force)
+ self.current_context = Context.new(
+ context_link_string, :force => force,
+ :replace_tag_string => replace_tag_string)
+ end
+
+ def not_empty(string)
+ if string.nil? or string.empty?
+ return nil
else
- self.current_context = nil
+ return string
end
end
Modified: trunk/app/controllers/comments_controller.rb
===================================================================
--- trunk/app/controllers/comments_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/comments_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -16,7 +16,7 @@
### Filters
- before_filter :resolve_context, :find_logi_and_logi_version,
+ before_filter :find_logi_and_logi_version,
:except => :index
### REST-methods
Modified: trunk/app/controllers/external_links_controller.rb
===================================================================
--- trunk/app/controllers/external_links_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/external_links_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -16,8 +16,7 @@
### Filters
- before_filter :resolve_context, :page_name,
- :find_logi_and_logi_version
+ before_filter :page_name, :find_logi_and_logi_version
### REST-methods
Modified: trunk/app/controllers/linked_logis_controller.rb
===================================================================
--- trunk/app/controllers/linked_logis_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/linked_logis_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -16,8 +16,8 @@
### Filters
- before_filter :resolve_context, :page_name,
- :find_logi_and_logi_version, :except => :index
+ before_filter :page_name, :find_logi_and_logi_version,
+ :except => :index
### REST-methods
Modified: trunk/app/controllers/links_controller.rb
===================================================================
--- trunk/app/controllers/links_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/links_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -16,8 +16,7 @@
### Filters
- before_filter :resolve_context, :page_name,
- :find_logi_and_logi_version, :except => :index
+ before_filter :page_name, :find_logi_and_logi_version
### REST-methods
Modified: trunk/app/controllers/logi_extras_controller.rb
===================================================================
--- trunk/app/controllers/logi_extras_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/logi_extras_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -18,7 +18,7 @@
### Filters
- before_filter :resolve_context, :find_logi_and_logi_version
+ before_filter :find_logi_and_logi_version
### REST-methods
Modified: trunk/app/controllers/logi_inserts_controller.rb
===================================================================
--- trunk/app/controllers/logi_inserts_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/logi_inserts_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -18,7 +18,7 @@
### Filters
- before_filter :resolve_context, :page_name, :find_logi_and_logi_version
+ before_filter :page_name, :find_logi_and_logi_version
### REST-methods
Deleted: trunk/app/controllers/logi_settings_controller.rb
===================================================================
--- trunk/app/controllers/logi_settings_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/logi_settings_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,61 +0,0 @@
-#--#
-# 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).
-#++#
-
-class LogiSettingsController < ApplicationController
- ### Layout
-
- layout 'blank'
-
- ### Filters
-
- before_filter :resolve_context, :page_name, :find_logi_and_logi_version
-
- ### Bodies
-
- top_body :navigation_bar_edit,
- : [:edit, :update]
-
- ### REST-methods
-
- def edit
- if !@logi.admin_rights?(current_user)
- flash[:warning] = t 'c.logi_settings.error_permission'
- redirect_to logi_ll_url(@logi)
- return
- end
- end
-
- def update
- if @logi.admin_rights?(current_user)
- if params[:logi][:delete]
- render_to_confirm_delete :text => t('c.logi_settings.confirm_delete'),
- :url => logi_url(@logi), :cancel_url => logi_url(@logi)
- elsif !@logi.user_group.public?
- @logi.restriction = params[:logi][:restriction]
- if @logi.save
- flash[:notice] = t 'c.logi_settings.updated'
- redirect_to logi_ll_url(@logi)
- else
- flash[:warning] = t 'c.logi_settings.error_updating'
- render :action => 'edit'
- end
- else
- flash[:error] = t 'c.logi_settings.error_permission'
- render :action => 'edit'
- end
- else
- flash[:error] = t 'c.logi_settings.error_permission'
- render :action => 'edit'
- end
- end
-end
Modified: trunk/app/controllers/logi_versions_controller.rb
===================================================================
--- trunk/app/controllers/logi_versions_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/logi_versions_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -16,7 +16,7 @@
### Filters
- before_filter :resolve_context, :page_name, :find_logi_and_logi_version
+ before_filter :page_name, :find_logi_and_logi_version
after_filter :clean_h1,
: [:diff]
Modified: trunk/app/controllers/logis_controller.rb
===================================================================
--- trunk/app/controllers/logis_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/logis_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -18,7 +18,7 @@
### Filters
- before_filter :resolve_context, :page_name,
+ before_filter :page_name,
:except => [:check]
before_filter :new_logi_and_logi_version,
: [:new]
@@ -72,27 +72,27 @@
render :partial => 'found_full_text_logis'
else
@primary_tabs = render_to_string(:partial => 'layouts/tabs')
- if current_context.nil?
+ if current_context.tags?
@add_tag_button = render_to_string(:partial => 'add_tag_button',
:locals => {:name => 'browse_list',
- :button_text => t('v.logis.search_word_or_tag'),
- :button_class => 'go_button'})
- @clear_button = ""
- else
- @add_tag_button = render_to_string(:partial => 'add_tag_button',
- :locals => {:name => 'browse_list',
:button_text => t('v.logis.add_word_or_tag')})
@clear_button = render_to_string(:partial => 'clear_button',
:locals => {:button_text => t('v.logis.clear_query')})
+ else
+ @add_tag_button = render_to_string(:partial => 'add_tag_button',
+ :locals => {:name => 'browse_list',
+ :button_text => t('v.logis.search_word_or_tag'),
+ :button_class => 'go_button'})
+ @clear_button = ""
end
render :template => 'logis/index_new_edit.js.rjs', :locals => {
:name => "browse_list",
- :url => (current_context.nil? ? nil : "/do/logis/" + current_context.link.to_s),
+ :url => (current_context.link? ? "/do/logis/" + current_context.link.to_s : nil),
:with_main => true}
end
end
format.xml do
- if current_context.nil?
+ if !current_context.link?
@logis = Logi.find(:all)
render :xml => @logis
end
@@ -128,7 +128,7 @@
self.new_edit_js_response
render :template => 'logis/index_new_edit.js.rjs', :locals => {
:name => "logi_tags_edit_list",
- :url => (current_context.nil? ? nil : "/" + current_context.link.to_s + "/do/new")}
+ :url => (current_context.link? ? "/" + current_context.link.to_s + "/do/new" : nil)}
end
end
end
@@ -181,7 +181,7 @@
self.new_edit_js_response
render :template => 'logis/index_new_edit.js.rjs', :locals => {
:name => "logi_tags_edit_list",
- :url => (current_context.nil? ? nil : "/" + current_context.link.to_s + "/do/edit")}
+ :url => (current_context.link? ? "/" + current_context.link.to_s + "/do/edit" : nil)}
end
end
end
@@ -285,16 +285,16 @@
select_body(@selected)
else
@primary_tabs = render_to_string(:partial => 'layouts/tabs')
- if current_context.nil?
+ if current_context.tags?
@add_tag_button = render_to_string(:partial => 'add_tag_button',
+ :locals => {:name => 'browse_list'})
+ @clear_button = render_to_string(:partial => 'clear_button')
+ else
+ @add_tag_button = render_to_string(:partial => 'add_tag_button',
:locals => {:name => 'browse_list',
:button_text => t('v.logis.set_tag'),
:button_class => 'go_button'})
@clear_button = ""
- else
- @add_tag_button = render_to_string(:partial => 'add_tag_button',
- :locals => {:name => 'browse_list'})
- @clear_button = render_to_string(:partial => 'clear_button')
end
end
end
@@ -310,14 +310,14 @@
def page_name
if params[:action] == "index"
@page_name = t 'c.logis.page_name.index'
- if !self.current_context.nil?
- @page_name += ' ' + self.current_context.link.to_s(
+ if current_context.link?
+ @page_name += ' ' + current_context.link.to_s(
:for => :show, :direction => :requested)
end
else
- if !self.current_context.nil?
+ if current_context.link?
@page_name = self.auto_page_name + ' - ' +
- self.current_context.link.to_s(
+ current_context.link.to_s(
:for => :show, :direction => :requested)
else
@page_name = ""
@@ -329,35 +329,15 @@
protected
- def content
- if !current_context.nil?
- @description = build_body :description
- @new_logis = build_body :new_logis
- else
- @found_logis = build_body :found_logis
- end
- end
-
- def side
- if !current_context.nil?
- @cloud = build_body :cloud
- @tag_sets = build_body :tag_sets
- @incoming_links_to_tags = build_body :incoming_links_to_tags
- else
- end
- end
-
- ### Sub-body-methods
-
def description
- if current_context.nil?
+ if !current_context.link?
render_body 'logis/small_snippet',
:locals => {:logi => Logi.main_page, :id => 'site_description'}
end
end
def new_logis
- if current_context.nil?
+ if !current_context.link?
@new_logis_count = Logi.count(:conditions => 'created_at > "' +
1.week.ago.to_s(:db) + '"')
@logis = Logi.recent.presentable.paginate(:page => params[:page],
@@ -366,7 +346,7 @@
end
def new_users
- if current_context.nil?
+ if !current_context.link?
@users = User.find(:all, :order => 'created_at DESC', :limit => 15)
@new_users_count = User.count(:conditions => 'created_at > "' +
1.week.ago.to_s(:db) + '"')
@@ -374,11 +354,11 @@
end
def found_logis
- if !current_context.nil?
+ if current_context.link?
@exact_matching_logis = current_context.exact_matching_logis
@sloppy_matching_logis = current_context.sloppy_matching_logis
@reduced_matching_logis = current_context.reduced_matching_logis
- if !current_context.any_match?
+ if !current_context.matches?
self.get_found_full_text_logis
else
@full_text_logis = nil
@@ -403,8 +383,8 @@
end
def tag_sets
- if !current_context.nil?
- if current_context.any_match?
+ if current_context.link?
+ if current_context.matches?
@tag_set_links = current_context.tag_set_links
else
# MAYDO: Can be optimized by special TagSet class in search index
@@ -415,13 +395,13 @@
end
def incoming_links_to_tags
- if !current_context.nil?
- @to_tags_links = self.current_context.incoming_links_to_tags
+ if current_context.tags?
+ @to_tags_links = current_context.incoming_links_to_tags
end
end
def cloud
- if current_context.nil?
+ if !current_context.tags?
@used_tags = UsedTag.top_used_tags(:limit => 57, :no_special => true)
else
@used_tags = current_context.suggested_used_tags(:limit => 57)
Modified: trunk/app/controllers/perma_links_controller.rb
===================================================================
--- trunk/app/controllers/perma_links_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/perma_links_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -16,14 +16,8 @@
### Filters
- before_filter :resolve_context, :page_name
- before_filter :find_logi_and_logi_version
+ before_filter :page_name, :find_logi_and_logi_version
- ### Bodies
-
- top_body :navigation_bar_edit,
- : [:create]
-
### REST-methods
def create
Modified: trunk/app/controllers/ratings_controller.rb
===================================================================
--- trunk/app/controllers/ratings_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/ratings_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -16,10 +16,8 @@
### Filters
- before_filter :resolve_context, :page_name,
+ before_filter :page_name, :find_logi_and_logi_version,
:except => [:listing, :index ]
- before_filter :find_logi_and_logi_version,
- :except => [:listing, :index]
### REST-methods
Modified: trunk/app/controllers/remarks_controller.rb
===================================================================
--- trunk/app/controllers/remarks_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/remarks_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -16,7 +16,7 @@
### Filters
- before_filter :resolve_context, :page_name, :find_logi_and_logi_version,
+ before_filter :page_name, :find_logi_and_logi_version,
:except => :index
### Bodies
Modified: trunk/app/controllers/votes_controller.rb
===================================================================
--- trunk/app/controllers/votes_controller.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/controllers/votes_controller.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -18,7 +18,7 @@
### Filters
- before_filter :resolve_context, :page_name, :find_logi_and_logi_version,
+ before_filter :page_name, :find_logi_and_logi_version,
:except => :index # ALERT needs except to stop it from calling these
# could become tricky where there already is an index method used
Modified: trunk/app/helpers/application_helper.rb
===================================================================
--- trunk/app/helpers/application_helper.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/helpers/application_helper.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -136,36 +136,6 @@
return tabs
end
- def navigation_tabs
- tabs = [{:text => t('h.application.search'), :name => "navigation_search",
- :url => searches_url(),
- :description => '<h2>' + t('h.application.searching') + '</h2>'},
- {:text => t('h.application.browse'), :name => "navigation_browse",
- :url => browse_logis_url(:ll_link_string => ''),
- :description => '<h2>' + t('h.application.browsing') + '</h2>'},
- {:text => t('h.application.view'), :name => "navigation_view",
- :description => '<h2>' + t('h.application.viewing') + '</h2>'},
-# {:text => t('h.application.insert'), :name => "navigation_insert",
-# :description => '<h2>' + t('h.application.inserting') + '</h2>'},
- {:text => t('h.application.edit'), :name => "navigation_edit",
- :description => '<h2>' + t('h.application.editing') + '</h2>'},
- {:text => t('h.application.create'), :name => "navigation_new",
- :url => new_logi_url(),
- :description => '<h2>' + t('h.application.creating') + '</h2>'}]
-
- if !current_context.nil? and current_context.link.found_logi?
- tabs[1][:url] = browse_ll_url(current_context.link)
- tabs[2][:url] = ll_url(current_context.link)
- logi = current_context.link.volatile_to_logi
-# tabs[3][:url] = new_logi_logi_inserts_url(logi)
- if logi.edit_rights?(current_user)
- tabs[3][:url] = edit_logi_url(current_context.link.volatile_to_logi)
-# tabs[4][:url] = edit_logi_url(current_context.link.volatile_to_logi)
- end
- end
- return tabs
- end
-
def add_simple_history(name, tags_string)
page << add_simple_history_string(name, tags_string)
end
@@ -231,10 +201,10 @@
def panel_tab_ajax_links(tabs, update)
tabs.each_with_index do |tab, i|
if !tab[:disabled]
- if current_context.nil?
- url = {}
- else
+ if current_context.link?
url = {:ll_link_string => current_context.link.to_s}
+ else
+ url = {}
end
tabs[i][:link] = link_to_remote(tab[:text], :update => update,
:url => url.update(:selected => tab[:name]), :method => :get)
@@ -451,7 +421,7 @@
tag_list_js_name + '.submit()'
return '<div class="floated_rounded_wrapper">' + link_to_js_rounded(
tag.to_s(:for => :show), js, 'tag cloud_tag ' +
- (current_context.nil? ? 'link_tag' : 'add_tag icon_tag') + ' ' +
+ (current_context.tags? ? 'add_tag icon_tag' : 'link_tag') + ' ' +
css_class) + '</div>'
end
Modified: trunk/app/models/context.rb
===================================================================
--- trunk/app/models/context.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/models/context.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -22,7 +22,7 @@
###### Relationships
- attr_accessor :force, :query
+ attr_accessor :force, :replace_tag, :query
attr_reader :link, :query, :context_link
###### Caches
@@ -36,9 +36,15 @@
# Sets the link, required as an option.
#
def initialize(query_string, options = {})
- self.force = options[:force]
- self.link = Link.new_from_s(query_string.dup)
- self.query = query_string
+ if query_string and !query_string.empty?
+ self.force = options[:force]
+ if options[:replace_tag_string]
+ self.replace_tag = Tag.from_s(options[:replace_tag_string])
+ end
+ # force and replace_tag need to be set before link
+ self.link = Link.new_from_s(query_string.dup)
+ self.query = query_string
+ end
return self
end
@@ -59,15 +65,26 @@
# Link-setter.
#
def link=(link)
- @link = link
- @link.resolve(:force => self.force)
- if !@link.to_logi.nil?
- # only needs tags for context_link
- @context_link = @link.unresolved_dup(:step => -1)
- @context_link.resolve(:force => self.force)
- else
- @context_link = @link
+ if self.replace_tag and
+ link.requested_tags[0] == self.replace_tag and
+ link.requested_tags.size == 1
+ if link.to_logi
+ link = Link.new_from_s(link.to_logi.to_s)
+ else
+ link = nil
+ end
end
+ if link
+ @link = link
+ @link.resolve(:force => self.force)
+ if @link.to_logi
+ # only needs tags for context_link
+ @context_link = @link.unresolved_dup(:step => -1)
+ @context_link.resolve(:force => self.force)
+ else
+ @context_link = @link
+ end
+ end
reset_methods_cache
end
@@ -153,10 +170,23 @@
# Returns true if there is any match.
#
- def any_match?
- return !self.context_link.volatile_all_logis.empty?
+ def matches?
+ return ((self.link? and self.link.found_logi?) or
+ (self.tags? and !self.context_link.volatile_all_logis.empty?))
end
+ # Returns true if there is any match.
+ #
+ def tags?
+ return !self.context_link.nil?
+ end
+
+ # Returns true if there is any match.
+ #
+ def link?
+ return !self.link.nil?
+ end
+
# Cached.
#
def contending_logis
Modified: trunk/app/models/link.rb
===================================================================
--- trunk/app/models/link.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/models/link.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -109,8 +109,8 @@
validate :quick_validate
validates_presence_of :from_logi
- validates_presence_of :requested_tags_string
- validates_presence_of :received_tags_string
+ validates_presence_of :requested_tags_string, :unless => Proc.new { |link| link.to_logi }
+ validates_presence_of :received_tags_string, :unless => Proc.new { |link| link.to_logi }
validates_presence_of :position_ranges_string
###### Acts_as
@@ -156,6 +156,9 @@
# Economics/Foucault/Non_Existing_Word/Botanics
#
def self.hash_from_s(link_string)
+ if link_string.empty?
+ raise ParsingError.new(link_string), t('m.link.error_invalid_string')
+ end
if GlobalConfig.done_with_basics?
if link_string =~ /\/\//
link_string.gsub!(/^.*?\/\/[^\/]+\//,"")
@@ -167,7 +170,9 @@
raise ParsingError.new(link_string), t('m.link.error_invalid_string')
end
link_hash = Hash.new
- link_hash[:requested_tags] = Tag.array_from_s(match[1])
+ if match[1]
+ link_hash[:requested_tags] = Tag.array_from_s(match[1])
+ end
if match[2] # requested-logi-and-version
link_hash.merge!(Link.requested_logi_and_version_hash_from_s(match[2]))
end
@@ -184,8 +189,8 @@
#
def self.new_from_h(link_hash)
navs_array = link_hash[:navs_array]
- if link_hash[:requested_tags].nil? or link_hash[:requested_tags].empty?
- raise HashError.new(link_hash), t('m.link.error_hash_without_requested_tags')
+ if link_hash[:requested_tags].nil? and link_hash[:to_logi_perma_id].nil?
+ raise HashError.new(link_hash), t('m.link.error_hash_without')
end
if link_hash[:to_logi_perma_id]
to_logi = Logi.from_h(:perma_id => link_hash[:to_logi_perma_id])
Modified: trunk/app/views/layouts/_tabs.html.erb
===================================================================
--- trunk/app/views/layouts/_tabs.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/layouts/_tabs.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,8 +1,6 @@
<div id="primarytabs">
<%
-if current_context.nil?
- view_u = logi_url(:ll_link_string => GlobalConfig.main_page_tag.to_s)
-else
+if current_context.link?
view_u = ll_url(current_context.link)
if current_context.link.found_logi?
@@ -11,6 +9,8 @@
edit_u = edit_logi_url(current_context.link.volatile_to_logi)
end
end
+else
+ view_u = logi_url(:ll_link_string => GlobalConfig.main_page_tag.to_s)
end
edit_u ||= nil
search_u = root_url()
Modified: trunk/app/views/logis/_clear_button.html.erb
===================================================================
--- trunk/app/views/logis/_clear_button.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/_clear_button.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,4 +1,4 @@
-<% if !current_context.nil? %>
+<% if current_context.tags? %>
<%= button_to_function (local_assigns[:button_text] ? local_assigns[:button_text] : t('v.logis.clear_tags')),
'browse_list.remove_all_tags(); browse_list.submit()',
:class => 'cancel_button' %>
Modified: trunk/app/views/logis/_navigation_bar_browse.html.erb
===================================================================
--- trunk/app/views/logis/_navigation_bar_browse.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/_navigation_bar_browse.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -5,12 +5,12 @@
:locals => {:button_text => t('v.logis.clear_query')} %>
</div>
<%= render :partial => 'tag_list', :locals => {:name => 'browse_list',
- :link => (current_context.nil? ? nil : current_context.link),
+ :link => current_context.link,
:url => browse_logis_url(:ll_link_string => ''),
:param_name => 'll_link_string',
- :replace_string => '', :without_spacer => true,
+ :without_spacer => true,
:no_focus => true, :replace_pre => true,
- :button_text => (current_context.nil? ? t('v.logis.search_word_or_tag') : t('v.logis.add_word_or_tag')),
- :button_class => (current_context.nil? ? 'go_button' : nil)} %>
+ :button_text => (current_context.tags? ? t('v.logis.add_word_or_tag') : t('v.logis.search_word_or_tag')),
+ :button_class => (current_context.tags? ? nil : 'go_button')} %>
<div class="spacer"></div>
<% end %>
Modified: trunk/app/views/logis/_navigation_bar_edit.html.erb
===================================================================
--- trunk/app/views/logis/_navigation_bar_edit.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/_navigation_bar_edit.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,16 +1,16 @@
<% render :layout => 'logis/navigation_bar', :locals => {
:selected => "navigation_edit"} do %>
<div id="clear_button_space">
- <%= render :partial => 'clear_button' %>
+ <%= render :partial => 'logis/clear_button' %>
</div>
- <%= render :partial => 'tag_list', :locals => {:name => 'logi_tags_edit_list',
- :link => (current_context.nil? ? nil : current_context.link),
+ <%= render :partial => 'logis/tag_list', :locals => {:name => 'logi_tags_edit_list',
+ :link => current_context.link,
:url => edit_logi_url(current_context.link.volatile_to_logi),
:param_name => 'new_ll_link_string',
- :replace_string => Tag.sandbox.to_s, :without_spacer => true,
+ :replace_tag => current_context.replace_tag, :without_spacer => true,
:no_focus => false, :replace_pre => false,
- :button_text => (current_context.nil? ? t('v.logis.set_tag') : nil),
- :button_class => (current_context.nil? ? 'go_button' : nil),
+ :button_text => (current_context.tags? ? nil : t('v.logis.set_tag')),
+ :button_class => (current_context.tags? ? nil : 'go_button'),
:logi_string => @logi.to_s} %>
<div class="spacer"></div>
<% end %>
Modified: trunk/app/views/logis/_navigation_bar_new.html.erb
===================================================================
--- trunk/app/views/logis/_navigation_bar_new.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/_navigation_bar_new.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -4,12 +4,12 @@
<%= render :partial => 'clear_button' %>
</div>
<%= render :partial => 'tag_list', :locals => {:name => 'logi_tags_edit_list',
- :link => (current_context.nil? ? nil : current_context.link),
+ :link => current_context.link,
:url => new_logi_url(),
:param_name => 'new_ll_link_string',
- :replace_string => Tag.sandbox.to_s, :without_spacer => true,
+ :replace_tag => current_context.replace_tag, :without_spacer => true,
:no_focus => false, :replace_pre => false,
- :button_text => (current_context.nil? ? t('v.logis.set_tag') : nil),
- :button_class => (current_context.nil? ? 'go_button' : nil)} %>
+ :button_text => (current_context.tags? ? nil : t('v.logis.set_tag')),
+ :button_class => (current_context.tags? ? nil : 'go_button')} %>
<div class="spacer"></div>
<% end %>
Modified: trunk/app/views/logis/_side_menu.html.erb
===================================================================
--- trunk/app/views/logis/_side_menu.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/_side_menu.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,46 +1,46 @@
-<% if current_context.nil? %>
+<% if !current_context.tags? %>
<% render :layout => 'application/attention_panel', :locals => {
:id => "set_tag"} do %>
<h2><%= t 'v.logis.set_a_tag' %></h2>
<p><%= t 'v.logis.like_tree' %></p>
<% end %>
<% else %>
-<%
-selected ||= "contending_logis"
-if params[:action] == "new" or params[:action] == "edit"
- tabs = new_side_menu_tabs()
-else
- tabs = side_menu_tabs()
-end
-%>
-<div id="<%= selected %>">
- <% render :layout => 'application/panel_with_tabs_ajax', :locals => {
- :tabs => tabs, :selected => selected, :id => "contenders",
- :update_selected => true} do %>
- <% case selected
- when "home_page" %>
+ <%
+ selected ||= "contending_logis"
+ if params[:action] == "new" or params[:action] == "edit"
+ tabs = new_side_menu_tabs()
+ else
+ tabs = side_menu_tabs()
+ end
+ %>
+ <div id="<%= selected %>">
+ <% render :layout => 'application/panel_with_tabs_ajax', :locals => {
+ :tabs => tabs, :selected => selected, :id => "contenders",
+ :update_selected => true} do %>
+ <% case selected
+ when "home_page" %>
<%= render :partial => 'home_page', :locals => {
- :contender_logis => current_context.contending_logis} %>
- <% when "contending_logis"%>
- <%= render :partial => 'contending_logis', :locals => {
- :contender_logis => current_context.contending_logis} %>
- <% when "comments_on"%>
- <%= render :partial => 'comments_on' %>
- <% when "paths"%>
- <%= render :partial => 'paths' %>
- <% else %>
- <div class="panel_content_padding">
- <%= render :partial => "incoming_links", :locals => {
- :incoming_links => current_context.incoming_links_to_logi} %>
- </div>
+ :contender_logis => current_context.contending_logis} %>
+ <% when "contending_logis"%>
+ <%= render :partial => 'contending_logis', :locals => {
+ :contender_logis => current_context.contending_logis} %>
+ <% when "comments_on"%>
+ <%= render :partial => 'comments_on' %>
+ <% when "paths"%>
+ <%= render :partial => 'paths' %>
+ <% else %>
+ <div class="panel_content_padding">
+ <%= render :partial => "incoming_links", :locals => {
+ :incoming_links => current_context.incoming_links_to_logi} %>
+ </div>
+ <% end %>
<% end %>
- <% end %>
- <% if selected == "comments_on" %>
- <%= render :partial => 'snippets_list',
- :locals => {:logis => @logi.comments_on_logis} %>
- <% end %>
- <% javascript_tag do -%>
- mcorners.run();
- <% end -%>
-</div>
+ <% if selected == "comments_on" %>
+ <%= render :partial => 'snippets_list',
+ :locals => {:logis => @logi.comments_on_logis} %>
+ <% end %>
+ <% javascript_tag do -%>
+ mcorners.run();
+ <% end -%>
+ </div>
<% end %>
Modified: trunk/app/views/logis/_tag_list.html.erb
===================================================================
--- trunk/app/views/logis/_tag_list.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/_tag_list.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -34,8 +34,8 @@
window.<%= name %> = new TagList('<%= name %>',
'<%= local_assigns[:url] %>',
'<%= param_name %>',
- '<%= (local_assigns[:replace_string] ? local_assigns[:replace_string] :
- Tag.replace.to_s(:for => :show)) %>',
+ '<%= (local_assigns[:replace_tag] ?
+ local_assigns[:replace_tag].to_s(:for => :show) : '') %>',
"<%= t('defaults.error_tag_invalid_string') %>",
"<%= t('defaults.error_tag_reserved_words') %>",
<%= local_assigns[:replace_pre] ? "true" : "false" %>,
Modified: trunk/app/views/logis/edit.html.erb
===================================================================
--- trunk/app/views/logis/edit.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/edit.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,4 +1,12 @@
<% thorny_form_for(@logi, :url => logi_url(@logi),
:html => {:id => "logi_form"}) do |form| %>
+ <%= render :partial => 'dhtml_history_js.html.erb' %>
+ <% javascript_tag do -%>
+ <% if !current_context.link? %>
+ if (dhtmlHistory.isFirstLoad()) {
+ <%= add_simple_history_string("", "") %>
+ }
+ <% end -%>
+ <% end %>
<%= render :partial => 'edit_with_tags', :locals => {:form => form} %>
<% end -%>
Modified: trunk/app/views/logis/index.html.erb
===================================================================
--- trunk/app/views/logis/index.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/index.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,7 +1,7 @@
<%# all is included via bodies for ajax #%>
<%= render :partial => 'dhtml_history_js.html.erb' %>
<% javascript_tag do -%>
- <% if current_context.nil? %>
+ <% if !current_context.link? %>
if (dhtmlHistory.isFirstLoad()) {
<%= add_simple_history_string("", "") %>
}
Modified: trunk/app/views/logis/index_new_edit.js.rjs
===================================================================
--- trunk/app/views/logis/index_new_edit.js.rjs 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/index_new_edit.js.rjs 2010-06-21 14:07:40 UTC (rev 1725)
@@ -7,8 +7,8 @@
page.replace_html 'side_body', @content_for_side_body
page.call("mcorners.run")
page.call(name + ".focus")
-if current_context.nil?
+if current_context.link?
+ page.add_simple_history(url, current_context.link.to_s)
+else
page.add_simple_history('', '')
-else
- page.add_simple_history(url, current_context.link.to_s)
end
Modified: trunk/app/views/logis/new.html.erb
===================================================================
--- trunk/app/views/logis/new.html.erb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/app/views/logis/new.html.erb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,6 +1,6 @@
<%= render :partial => 'dhtml_history_js.html.erb' %>
<% javascript_tag do -%>
- <% if current_context.nil? %>
+ <% if !current_context.link? %>
if (dhtmlHistory.isFirstLoad()) {
<%= add_simple_history_string("","") %>
}
Modified: trunk/config/locales/en.yml
===================================================================
--- trunk/config/locales/en.yml 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/config/locales/en.yml 2010-06-21 14:07:40 UTC (rev 1725)
@@ -418,7 +418,7 @@
not_permitted: "problem. You are not permitted to create an invitation with this role."
provide_email: "needs to be provided, or an user name."
link:
- error_hash_without_requested_tags: "Linkhash without :requested_tags given."
+ error_hash_without: "Linkhash without :requested_tags and :to_logi given."
error_invalid_specs: "Invalid specs part of the link-string."
error_invalid_string: "Can't make a link of this string."
error_version_malformed: "Kind or logi(version) string malformed."
Added: trunk/db/migrate/20100614144931_tagless_links.rb
===================================================================
--- trunk/db/migrate/20100614144931_tagless_links.rb (rev 0)
+++ trunk/db/migrate/20100614144931_tagless_links.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -0,0 +1,10 @@
+class TaglessLinks < ActiveRecord::Migration
+ def self.up
+ change_column :links, :requested_tags_string, :string, :limit => 120, :null => true
+ change_column :links, :received_tags_string, :string, :limit => 120, :null => true
+ end
+
+ def self.down
+ raise 'No way back'
+ end
+end
Modified: trunk/db/schema.rb
===================================================================
--- trunk/db/schema.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/db/schema.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20100324102758) do
+ActiveRecord::Schema.define(:version => 20100614144931) do
create_table "acts_as_xapian_jobs", :force => true do |t|
t.string "model", :null => false
@@ -125,8 +125,8 @@
t.integer "from_logi_id", :null => false
t.integer "to_logi_id"
t.integer "to_logi_version_nr"
- t.string "requested_tags_string", :limit => 120, :null => false
- t.string "received_tags_string", :limit => 120, :null => false
+ t.string "requested_tags_string", :limit => 120
+ t.string "received_tags_string", :limit => 120
t.string "position_ranges_string", :limit => 512, :null => false
t.integer "stance", :null => false
t.datetime "created_at", :null => false
Modified: trunk/lib/modules/tags_strings_module.rb
===================================================================
--- trunk/lib/modules/tags_strings_module.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/lib/modules/tags_strings_module.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -50,11 +50,13 @@
class_eval <<-EOS
attr_reader :#{name}tags
def #{name}tags=(new_tags)
- new_tags.uniq!
- if new_tags.size > 7
- self.errors.add :tags, "are limited to 7 for each logi"
+ if new_tags
+ new_tags.uniq!
+ if new_tags.size > 7
+ self.errors.add :tags, "are limited to 7 for each logi"
+ end
+ @#{name}tags = new_tags
end
- @#{name}tags = new_tags
end
EOS
end
@@ -82,9 +84,13 @@
adder = "define_method(:tags_strings_before_validation) do\n"
names.each do |name|
adder += <<-EOS
+ if @#{name}tags
self.#{name}tags_string = @#{name}tags.collect {|t|
t.to_s
}.join('/')
+ else
+ self.#{name}tags_string = nil
+ end
EOS
end
adder += "return true\n" +
Modified: trunk/test/fixtures/link_matches.yml
===================================================================
--- trunk/test/fixtures/link_matches.yml 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/fixtures/link_matches.yml 2010-06-21 14:07:40 UTC (rev 1725)
@@ -13,6 +13,9 @@
second_logi_link_m1:
link: second_logi
logi: logi_logi
+only_logi_link_m1:
+ link: only_logi
+ logi: logi_logi_manta
logi_version_link_m1:
link: logi_version
logi: michel_foucault_politics_medieval_peter_abelard_economics
Modified: trunk/test/fixtures/links.yml
===================================================================
--- trunk/test/fixtures/links.yml 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/fixtures/links.yml 2010-06-21 14:07:40 UTC (rev 1725)
@@ -32,6 +32,13 @@
position_ranges_string: '338,349'
stance: <%= Const::Link::STANCES[:reference] %>
created_at: <%= 1.days.ago.to_s(:db) %>
+only_logi:
+ user: john_johnson
+ from_logi: logi_logi
+ to_logi: logi_logi_manta
+ position_ranges_string: '350,352'
+ stance: <%= Const::Link::STANCES[:reference] %>
+ created_at: <%= 1.days.ago.to_s(:db) %>
logi_version:
user_id: <%= User.anonymous.id %>
from_logi: logi_logi
Deleted: trunk/test/functional/logi_settings_controller_test.rb
===================================================================
--- trunk/test/functional/logi_settings_controller_test.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/functional/logi_settings_controller_test.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,58 +0,0 @@
-#--#
-# 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 'logis_controller'
-
-class LogiSettingsControllerTest < ActionController::TestCase
- fixtures :all
-
- def setup
- @controller = LogiSettingsController.new
- setup_request
- end
-
- ### Actions
-
- # REST-methods
-
- def test_edit
- l = logis(:sailing)
- get :edit, :ll_link_string => l.link.to_s
- assert_response :redirect
- end
-
- def test_update
- l = logis(:logi_logi)
-
- # no permission
- post :update, :ll_link_string => l.link.to_s,
- :logi => {:restriction => Const::Logi::OVERSEER}
- assert_response :success
- l.reload
- assert_equal Const::Logi::EDIT, l.restriction
-
- # now with permission
- login(:eduard_edison)
- post :update, :ll_link_string => l.link.to_s,
- :logi => {:restriction => Const::Logi::OVERSEER}
- assert_response :redirect
- l.reload
- assert_equal Const::Logi::OVERSEER, l.restriction
-
- # redirect to deletion-confirmation
- post :update, :ll_link_string => l.link.to_s,
- :logi => {:delete => true}
- assert_response :success
- end
-end
Modified: trunk/test/functional/logis_controller_test.rb
===================================================================
--- trunk/test/functional/logis_controller_test.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/functional/logis_controller_test.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -27,8 +27,17 @@
# REST-methods
def test_index
+ get :index
+ assert_response :success
+
get :index, :ll_link_string => logis(:logi_logi).link.to_s
assert_response :success
+
+ # takes some time...
+ system "cd #{File.dirname(__FILE__)}/../..; rake index:redo RAILS_ENV=test"
+ get :index, :query => 'place where'
+ assert_response :success
+ assert assigns(:logis).size > 0
end
def test_show
Deleted: trunk/test/functional/main_page_controller_test.rb
===================================================================
--- trunk/test/functional/main_page_controller_test.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/functional/main_page_controller_test.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,33 +0,0 @@
-#--#
-# 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 'main_page_controller'
-
-class MainPageControllerTest < ActionController::TestCase
- fixtures :all
-
- def setup
- @controller = MainPageController.new
- setup_request
- end
-
- ### Actions
-
- # REST-methods
-
- def test_index
- get :index
- assert_response :success
- end
-end
Modified: trunk/test/functional/perma_links_controller_test.rb
===================================================================
--- trunk/test/functional/perma_links_controller_test.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/functional/perma_links_controller_test.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -32,31 +32,37 @@
nr_of_l = l.from_links.size
l_v = l.current_logi_version
b_t = l_v.body
- manta = logis(:logi_logi_manta)
- l_l = "http://en.edge.logilogi.org/" + manta.link.to_s # The inserted link
+ lubber = logis(:lubber)
+ l_l = "http://en.edge.logilogi.org/" + lubber.link.to_s # The inserted link
+
new_b_t = b_t[0...49] + '<a class="selection" target="' + l_l + '">' +
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)
+
assert_response :redirect
assert_equal nr_of_l + 1, l.from_links.size
- manta_l = l.from_links.find_by_to_logi_id(manta.id)
- assert manta_l
- assert_equal l_v.raw_title.size + 49, manta_l.position_ranges.first.first
- assert_equal l_v.raw_title.size + 63, manta_l.position_ranges.first.last
+ lubber_l = l.from_links.find_by_to_logi_id(lubber.id)
+ assert lubber_l
+ assert_equal l_v.raw_title.size + 49, lubber_l.position_ranges.first.first
+ assert_equal l_v.raw_title.size + 63, lubber_l.position_ranges.first.last
end
- def test_create_only_perma_links
+ def test_create_perma_links_only
l = logis(:logi_logi)
nr_of_l = l.from_links.size
l_v = l.current_logi_version
b_t = l_v.body
l_l_tag = "Manta"
l_l = "http://en.edge.logilogi.org/" + l_l_tag # The inserted link
+
new_b_t = b_t[0...49] + '<a class="selection" target="' + l_l + '">' +
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)
+
assert_equal nr_of_l, l.from_links.size # no new link
end
end
Deleted: trunk/test/functional/searches_controller_test.rb
===================================================================
--- trunk/test/functional/searches_controller_test.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/functional/searches_controller_test.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -1,34 +0,0 @@
-#--#
-# 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 'searches_controller'
-
-class SearchesControllerTest < ActionController::TestCase
- fixtures :all
-
- def setup
- @controller = SearchesController.new
- setup_request
- end
-
- ### Actions
-
- def test_create
- # takes some time...
- system "cd #{File.dirname(__FILE__)}/../..; rake index:redo RAILS_ENV=test"
- post :create, :query => 'place where'
- assert_response :success
- assert assigns(:logis).size > 0
- end
-end
Modified: trunk/test/test_helper.rb
===================================================================
--- trunk/test/test_helper.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/test_helper.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -84,7 +84,7 @@
end
end
rescue => error
- puts error.to_s + ' on: ' + test_key.to_s + ',: ' + source[test_key] +
+ puts error.to_s + ' on: ' + test_key.to_s + ',: ' + source[test_key].to_s +
', error: ' + $!
puts error.backtrace
end
Modified: trunk/test/unit/context_test.rb
===================================================================
--- trunk/test/unit/context_test.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/unit/context_test.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -37,6 +37,19 @@
assert_equal [Tag.from_s('Logi_Logi'),Tag.from_s('Manta')], c.link.received_tags
end
+ def test_replace_tag_string
+ c = Context.new(Tag.sandbox.to_s,
+ :replace_tag_string => Tag.sandbox.to_s,
+ :force => true)
+ assert !c.link?
+
+ c = Context.new(Tag.sandbox.to_s + logis(:botanics).to_s,
+ :replace_tag_string => Tag.sandbox.to_s,
+ :force => true)
+ assert_equal 0, c.link.received_tags.size
+ assert c.link.to_logi
+ end
+
### Tag sets
def test_tag_set_links
Modified: trunk/test/unit/link_test.rb
===================================================================
--- trunk/test/unit/link_test.rb 2010-06-13 18:28:47 UTC (rev 1724)
+++ trunk/test/unit/link_test.rb 2010-06-21 14:07:40 UTC (rev 1725)
@@ -668,6 +668,8 @@
'Peter_Abelard_Economics',
:tag_logi =>
'Logi_Logi' + logis(:logi_logi).to_s,
+ :logi =>
+ logis(:logi_logi).to_s,
:tag_logi_version =>
'Logi_Logi' + logis(:logi_logi).to_s + '=v2',
:tag_current_logi_version =>
@@ -701,6 +703,9 @@
:tag_logi =>
[test_link_string_hash[:tag_logi],
'Logi_Logi', logis(:logi_logi).to_s, nil, nil],
+ :logi =>
+ [test_link_string_hash[:logi],
+ nil, logis(:logi_logi).to_s, nil, nil],
:tag_logi_version =>
[test_link_string_hash[:tag_logi_version],
'Logi_Logi', logis(:logi_logi).to_s + '=v2', nil, nil],
@@ -753,6 +758,10 @@
{:requested_tags => [Tag.from_s('Logi_Logi')],
:to_logi_perma_id => logis(:logi_logi).perma_id
},
+ :logi =>
+ {:requested_tags => nil,
+ :to_logi_perma_id => logis(:logi_logi).perma_id
+ },
:tag_logi_version =>
{:requested_tags => [Tag.from_s('Logi_Logi')],
:to_logi_perma_id => logis(:logi_logi).perma_id,
@@ -808,6 +817,10 @@
{:requested_tags => [Tag.from_s('Peter_Abelard_Economics')]
},
:tag_logi =>
+ {:requested_tags => [Tag.from_s('Logi_Logi')],
+ :to_logi => logis(:logi_logi)
+ },
+ :logi =>
{:to_logi => logis(:logi_logi)
},
:tag_logi_version =>
@@ -864,8 +877,12 @@
]
},
:tag_logi =>
- {:to_logi => logis(:logi_logi),
+ {:received_tags => [Tag.from_s('Logi_Logi')],
+ :to_logi => logis(:logi_logi)
},
+ :logi =>
+ {:to_logi => logis(:logi_logi)
+ },
:tags =>
{:received_tags => [Tag.from_s('Peter_Abelard'),Tag.from_s('Botanics')]
},
@@ -900,6 +917,8 @@
return {
:tag_logi =>
'Logi Logi' + logis(:logi_logi).to_s + '=v2',
+ :logi =>
+ 'Logi Logi' + logis(:logi_logi).to_s + '=v2',
:tag_logi_version =>
'Logi Logi' + logis(:logi_logi).to_s + '=v2',
:non_existing_tag =>
@@ -928,6 +947,8 @@
return {
:tag_logi =>
'Logi_Logi' + logis(:logi_logi).to_s + '=v2',
+ :logi =>
+ 'Logi_Logi' + logis(:logi_logi).to_s + '=v2',
:tag_logi_version =>
'Logi_Logi' + logis(:logi_logi).to_s + '=v2',
:non_existing_tag =>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|