Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate the edit mode by default and set the default space to 'Totem' #6

Merged
merged 10 commits into from May 26, 2015

Conversation

@mouhb
Copy link
Contributor

mouhb commented May 4, 2015

No description provided.

#set($totemViewURL = $doc.getURL())
#set($totemEditURL = $doc.getURL('view','showEdit=true'))
#set($totemDocURL = $xwiki.getURL('TotemCode.Documentation','view'))
{{html clean="false" wiki="true"}}

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 21, 2015

Contributor

You should avoid this.

  • "clean = false" so it means if you have errors in your HTML they won't be fixed. I agrea, sometimes we need to disable the cleaner, but here I see no reason to do it.
  • "wiki = true" means that you can use Wiki syntax inside your macro. This is very dangerous because you can easily have problems by mixing up Wiki and HTML syntaxes. Here, again, I see no reason to do it.

This comment has been minimized.

Copy link
@mouhb

mouhb May 21, 2015

Author Contributor

If I don't put the clear = false it will generate an exception

https://ezcrypt.it/QzAn#PsPExj6Rr09aIuvCWQcOL7KG

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 21, 2015

Contributor

I see. Then you should put an empty line before and after the call of #displayTotemActionsLinks(). The problem is that the HTML macro is used inline meanwhile it should be seen as a separate "block".

{{html clean="false" wiki="true"}}
<div class="clearfix">
<div class="pull-right">
<a class="btn btn-info" href="$totemDocURL" target="_blank"><span class="glyphicon glyphicon-book"></span> $services.localization.render('totem.edit.documentation')</a>

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 21, 2015

Contributor

By using glyphicon, your application will not work with Colibri, but only with Flamingo. That could be an acceptable limitation. But in general, prefer:
$services.icon.renderHTML('book')

In colibri, you will have the silk icon, in Flamingo, you will have a font-awesome icon.

Here the list of available icons through this API: http://design.xwiki.org/xwiki/bin/view/Proposal/XWiki+Icon+Set

This comment has been minimized.

Copy link
@mouhb

mouhb May 21, 2015

Author Contributor

Is there a way to get only the URL of the icon from the API without html ?

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 21, 2015

Contributor

Why do you need that?

This comment has been minimized.

Copy link
@mouhb

mouhb May 21, 2015

Author Contributor

If there is a method in the API that return the URL of a given image.

But I think that the images are not saved separately, it is a css framework.

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 21, 2015

Contributor

The problem is icons are not necessary images. They could be characters in an icon font (like glyphicon or font-awesome).

What you need to do is replacing:

<a class="btn btn-info" href="$totemDocURL" target="_blank"><span class="glyphicon glyphicon-book"></span> $services.localization.render('totem.edit.documentation')</a>

by:

<a class="btn btn-info" href="$totemDocURL" target="_blank">$services.icon.renderHTML('book') $services.localization.render('totem.edit.documentation')</a>

More infos on http://extensions.xwiki.org/xwiki/bin/view/Extension/Icon+Theme+Application.

}
}
})
<code>document.observe('xwiki:dom:loading', function() {

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 21, 2015

Contributor

I don't think you need to do document.observe('xwiki:dom:loading').

}
})
<code>document.observe('xwiki:dom:loading', function() {
// Configure require.js to use jquery-form (https://github.com/malsup/form)

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 21, 2015

Contributor

Please put these lines in the top of the previous JSX object, and remove this useless object.

return o;
};

<code>require (['jquery'],function($) {

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 21, 2015

Contributor

Here you can do:

require (['jquery', 'jquery-form'], function($, jqf) {

and you'll get all the dependencies once for all.

error: function (data, status, e){
}
});
require(['jquery-form'],function(jqf) {

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 21, 2015

Contributor

If you do what I suggested you in the previous comment, you would not need this line anymore.

#set($SuggestDisplayItemsEditable = true)
#set($SuggestDisplayEditModeSpace = "Totem")
{{/velocity}}
{{include document="xwiki:XWiki.SuggestDisplay" /}}</customDisplay>

This comment has been minimized.

Copy link
@gdelhumeau

gdelhumeau May 26, 2015

Contributor

Why do you force the document to be on the main wiki? You prevent MSD to be installed on the current wiki.

The document parameter is deprecated (http://extensions.xwiki.org/xwiki/bin/view/Extension/Include+Macro).

Please do:

{{include reference="XWiki.SuggestDisplay" /}}
gdelhumeau added a commit that referenced this pull request May 26, 2015
XTOTEM-34: Activate the edit mode by default and set the default space to 'Totem'.
@gdelhumeau gdelhumeau merged commit 41710e3 into xwiki-contrib:master May 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.