Skip to content

Commit

Permalink
Remove edit tab from data ns
Browse files Browse the repository at this point in the history
patch set 2: added a selenium test for that

Change-Id: I9181612615ea2c791befe8f00eab7cc6cfe2800a
  • Loading branch information
JeroenDeDauw authored and tobijat committed Jun 28, 2012
1 parent cea0078 commit fe5fe26
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
19 changes: 19 additions & 0 deletions repo/Wikibase.hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,23 @@ public static function onWikibaseDefaultSettings( array &$settings ) {
return true;
}

/**
* Alter the structured navigation links in SkinTemplates.
* @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation
*
* @since 0.1
*
* @param SkinTemplate $sktemplate
* @param array $links
*
* @return boolean
*/
public static function onPageTabs( SkinTemplate &$sktemplate, array &$links ) {
if ( $sktemplate->getTitle()->inNamespaces( WB_NS_DATA, WB_NS_DATA_TALK ) ) {
unset( $links['views']['edit'] );
}

return true;
}

}
1 change: 1 addition & 0 deletions repo/Wikibase.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
$wgHooks['ResourceLoaderTestModules'][] = 'WikibaseHooks::onResourceLoaderTestModules';
$wgHooks['NamespaceIsMovable'][] = 'WikibaseHooks::onNamespaceIsMovable';
$wgHooks['NewRevisionFromEditComplete'][] = 'WikibaseHooks::onNewRevisionFromEditComplete';
$wgHooks['SkinTemplateNavigation'][] = 'WikibaseHooks::onPageTabs';


// Resource Loader Modules:
Expand Down
3 changes: 3 additions & 0 deletions repo/tests/selenium/lib/pages/item_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class ItemPage < RubySelenium
link(:saveDescriptionLink, :css => "div.wb-ui-descriptionedittool > span > span.wb-ui-propertyedittool-editablevalue-toolbarparent > div.wb-ui-toolbar > div.wb-ui-toolbar-group > div.wb-ui-toolbar-group > a.wb-ui-toolbar-button:nth-child(1)")

span(:apiCallWaitingMessage, :class => "wb-ui-propertyedittool-editablevalue-waitmsg")

# edit-tab
list_item(:editTab, :id => "ca-edit")

def wait_for_item_to_load
wait_until do
Expand Down
18 changes: 18 additions & 0 deletions repo/tests/selenium/spec/item/edit_tab_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Wikidata UI tests
#
# Author:: Tobias Gritschacher (tobias.gritschacher@wikimedia.de)
# License:: GNU GPL v2+
#
# tests for item: check edit-tab

require 'spec_helper'

describe "Check functionality of edit-tab" do
context "Check if edit-tab is hidden when showing an item" do
it "should check that the edit-tab is not shown on the item page" do
visit_page(NewItemPage)
@current_page.create_new_item(generate_random_string(10), generate_random_string(20))
@current_page.editTab?.should be_false
end
end
end

0 comments on commit fe5fe26

Please sign in to comment.