Skip to content

Commit

Permalink
Fixes #2 by increasing plugin template compatibility (#3)
Browse files Browse the repository at this point in the history
Updates javascript & rendered html to use a more descriptive class selector in the `<a>` tag  instead of relying on the `<li>` tag's class
  • Loading branch information
SoarinFerret authored Mar 22, 2021
1 parent 9bf7f34 commit 28bf71c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
9 changes: 9 additions & 0 deletions DeletePageButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,13 @@ public function getLabel() {
//return $plugin->getLang('delete_menu_item');
}

public function getLinkAttributes($classprefix = 'menuitem ') {
$attr = parent::getLinkAttributes($classprefix);
if (empty($attr['class'])) {
$attr['class'] = '';
}
$attr['class'] .= ' plugin_pagebuttons_deletepage ';
return $attr;
}

}
9 changes: 9 additions & 0 deletions NewFolderButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,13 @@ public function getLabel() {
//return $plugin->getLang('newfolder_menu_item');
}

public function getLinkAttributes($classprefix = 'menuitem ') {
$attr = parent::getLinkAttributes($classprefix);
if (empty($attr['class'])) {
$attr['class'] = '';
}
$attr['class'] .= ' plugin_pagebuttons_newfolder ';
return $attr;
}

}
9 changes: 9 additions & 0 deletions NewPageButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,13 @@ public function getLabel() {
//return $plugin->getLang('newpage_menu_item');
}

public function getLinkAttributes($classprefix = 'menuitem ') {
$attr = parent::getLinkAttributes($classprefix);
if (empty($attr['class'])) {
$attr['class'] = '';
}
$attr['class'] .= ' plugin_pagebuttons_newpage ';
return $attr;
}

}
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base pagebuttons
author Cody Ernesti
email [email protected]
date 2020-09-14
date 2021-03-22
name Page Buttons plugin
desc Adds a PageMenu button to Delete the current page, add a subpage, and add a subfolder
url https://www.dokuwiki.org/plugin:pagebuttons
6 changes: 3 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jQuery(function() {
var usePrompt = JSINFO['plugin_pagebuttons']['usePrompt'];
}

jQuery('.deletepagebutton a').click(function(d) {
jQuery('.plugin_pagebuttons_deletepage').click(function(d) {
d.preventDefault();

var submit_url = this.href;
Expand Down Expand Up @@ -70,7 +70,7 @@ jQuery(function() {
}
});

jQuery('.newfolderbutton a').click(function(f) {
jQuery('.plugin_pagebuttons_newfolder').click(function(f) {
f.preventDefault();

var pre_url = window.location.href.substring(0, window.location.href.indexOf(JSINFO['id'])) + JSINFO['namespace'];
Expand Down Expand Up @@ -125,7 +125,7 @@ jQuery(function() {
}
});

jQuery('.newpagebutton a').click(function(p) {
jQuery('.plugin_pagebuttons_newpage').click(function(p) {
p.preventDefault();

var pre_url = window.location.href.substring(0, window.location.href.indexOf(JSINFO['id'])) + JSINFO['namespace'];
Expand Down

0 comments on commit 28bf71c

Please sign in to comment.