I have recently started working with JointJS. I have not seen any example/tutorial on their website mentioning creating of link again once it is deleted. For example on this link.
http://jointjs.com/demos/org
I wonder if its possible to create the link again between the two Members once it is deleted.
I tried with this code in the function function (x, y, rank, background, textColor):
'.rank': { text: rank, fill: textColor, 'word-spacing': '-5px', 'letter-spacing': 0, magnet: true, pointerevents:'none' }
But its not working.
I am not sure if the member type has ports. If yes you need to add ports to recreate the links once rendered. If you look at the source code, the links are created during render so if you refresh the page or run the code again the links come back.
Related
I want to be able to change the value of a TV for Resources shown in a Collections grid using a dropdown select bo.
Can anyone provide an example of how to create a select box in a Collection grid that is either
populated from the options in an existing Template Variable
populated from a fixed list, simply options 1, 2, 3
I understand this is possible but can't find an example close enough to what I need to achieve that I can figure it out on my own.
Things I’ve tried are
I have seen Susan Otwell’s example of how to change Created By with a select box
http://modxcookbook.com/add-ons/collections/editable-grid-view.html
Discussion linked below addresses a similar problem but remains unanswered
https://forums.modx.com/thread/95984/adding-modx-combo-to-collections-list
MIGX configuration and syntax appear similar but not close enough that I can figure what I need to do
https://forums.modx.com/thread/91403/single-select-listbox-entries-in-migx
MODx.combo.ComboBox docs look like they have some relevant detail but I don’t know enough to understand if this is useful
https://docs.modx.com/revolution/2.x/developing-in-modx/advanced-development/custom-manager-pages/modext/modx.combo.combobox
I've looked for examples of similar dropdowns in the source code of other Extras. I see xtype references but am unable to reverse engineer them to figure what I need to create my own dropdown in the Collections grid.
Susan Otwell's example above creates a dropdown based on xtype modx-combo-user. This looks close to what I need but I can't figure how to adapt this to create a dropdown from either TV values or a fixed list.
{"xtype":"modx-combo-user","renderer":true,"fields": ["fullname","username","id"],"displayField": "fullname","baseParams": {"action": "security/user/getlist","usergroup":2}}
Can anyone provide an example or point me to another resource that may help?
I just answered this one on the MODX forums but here it is for anyone on StackOverflow:
Create a JS file in your assets directory. For simplicity sake,
create a file called test.js in your assets directory.
Go to the MODX system settings page and select the Collections namespace filter. Then in the collections.user_js setting, enter the
value: {assets_url}test.js. This will instruct Collections to load
your new test.js file whenever Collections is initiated.
For this example, copy and paste the following ZoomLevel (meant for Google Maps zoom) example into your new test.js file.
collections.combo.ZoomLevel = function(config) {
config = config || {};
Ext.applyIf(config,{
store: new Ext.data.ArrayStore({
id: 0
,fields: ['level']
,data: [
['1'],
['2'],
['3'],
['4'],
['5'],
['6'],
['7'],
['8'],
['9'],
['10'],
['11'],
['12'],
['13'],
['14'],
['15'],
['16'],
['17'],
['18'],
['19'],
['20'],
['21']
]
})
,mode: 'local'
,displayField: 'level'
,valueField: 'level'
,name: 'zoom_level'
,hiddenName:'zoom_level'
});
collections.combo.ZoomLevel.superclass.constructor.call(this,config);
};
Ext.extend(collections.combo.ZoomLevel,MODx.combo.ComboBox);
Ext.reg('collections-combo-zoomlevel',collections.combo.ZoomLevel);
Once pasted, save the file.
Go to your collections view page and add a new column for your collections grid. In the editor field, copy and paste the following JSON:
{
"xtype": "collections-combo-zoomlevel",
"renderer": true
}
You now have a combobox editor with the values we defined in the test.js file.
These combo-boxes are very configurable but it can be a bit of a steep learning curve to find out what setting does what.
Here you can see the combos that Collections itself defines:
https://github.com/modxcms/Collections/blob/9a328fa881b76e2ce355876156eaca3126065717/assets/components/collections/js/mgr/extra/collections.combo.js
I've copied the hello world example into a VueJS app, things work as expected.
I then changed added:
router: { name: 'manhattan' },
to the link constructor. when I move the nodes around I get the link rendering as in the attached screen shot.
Has anyone else ever encountered this and have a fix?
mc.
most likely you've forgotten to include the join.css stylesheet
I have a Google Partner Badge on my site, based on code that Google provides. They provide the code, and it creates a dynamic image on my site, that is clickable and a live link. However, the cursor does not change to a hand when over the image or indicate it is a live link in any way. In my opinion, this is bad UX.
I want to simply make the cursor change to a hand when hovering over the image.
But again, the original code is provided by an external site. Can this be done?
Try This:
<span style="cursor:pointer">
// external code here
</span>
inspect elements then find the container of that image, then add style on it.
.containerOfGoogleBadge {
cursor:pointer;
}
I am trying to create an interactive map where users can click on different provinces in the map to get info specific to that province.
Example:
archived: http://www.todospelaeducacao.org.br/
archived: http://code.google.com/p/svg2imap/
So far I've only found solutions that have limited functionality. I've only really searched for this using an SVG file, but I would be open to other file types if it is possible.
If anyone knows of a fully functioning way to do this (jQuery plug-in, PHP script, vector images) or a tutorial on how to do it manually please do share.
jQuery plugin for decorating image maps (highlights, select areas, tooltips):
http://www.outsharked.com/imagemapster/
Disclosure: I wrote it.
Sounds like you want a simple imagemap, I'd recommend to not make it more complex than it needs to be. Here's an article on how to improve imagemaps with svg. It's very easy to do clickable regions in svg itself, just add some <a> elements around the shapes you want to have clickable.
A couple of options if you need something more advanced:
http://jqvmap.com/
http://jvectormap.com/
http://polymaps.org/
I think it's better to divide my answer to 2 parts:
A-Create everything from scratch (using SVG, JavaScript, and HTML5):
Create a new HTML5 page
Create a new SVG file, each clickable area (province) should be a separate SVG Polygon in your SVG file,
(I'm using Adobe Illustrator for creating SVG files but you can find many alternative software products too, for example Inkscape)
Add mouseover and click events to your polygons one by one
<polygon points="200,10 250,190 160,210" style="fill:lime;stroke:purple;stroke-width:1"
onmouseover="mouseOverHandler(evt)"
onclick="clickHandler(evt)" />
Add a handler for each event in your JavaScript code and add your desired code to the handler
function mouseOverHandler(evt) {};
function clickHandler(evt) {};
Add the SVG file to your HTML page (I prefer inline SVG but you can use linked SVG file too)
Upload the files to your server
B-Use a software like FLDraw Interactive Image Creator (only if you have a map image and want to make it interactive):
Create an empty project and choose your map image as your base image when creating the new project
Add a Polygon element (from the Shape menu) for each province
For each polygon double click it to open the Properties window where you can choose an event type for mouse-over and click,
also change the shape opacity to 0 to make it invisible
Save your project and Publish it to HTML5, FLDraw will create a new folder that contains all of the required files for your project that you can upload to your server.
Option (A) is very good if you are programmer or you have someone to create the required code and SVG file for you,
Option (B) is good if you don't want to hire someone or spend your own time for creating everything from scratch
You have some other options too, for example using HTML5 Canvas instead of SVG, but it's not very easy to create a Zoomable map using HTML5 Canvas,
maybe there are some other ways too that I'm not aware of.
Just in case anyone will search for it - I used it on several sites, always the customization and RD possibilities were a perfect fit for what I needed. Simple and it is free to use:
Clickable CSS Maps
One note for more scripts on a site: I had some annoying problems with getting to work a map (that worked as a graphic menu) in Drupal 7. There where many other script used, and after handling them, I got stuck with the map - it still didn't work, although the jquery.cssmap.js, CSS (both local) and the script in the where in the right place. Firebug showed me an error and I suddenly eureka - a simple oversight, I left the script code as it was in the example and there was a conflict. Just change the front function "$" to "jQuery" (or other handler) and it works perfect. :]
Here's what I ment (of course you can put it before instead of the ):
<script type="text/javascript">
jQuery(function($){
$('#map-country').cssMap({'size' : 810});
});
</script>
Go to SVG to Script
with your SVG the default output is the map in SVG
Code which adds events is also added but is easily identified and can be altered as required.
I have been using makeaclickablemap for my province maps for some time now and it turned out to be a really good fit.
I had the same requirements and finally this Map converter worked for me. It is the best plugin for any map generation.
Here is another image map plugin I wrote to enhance image maps: https://github.com/gestixi/pictarea
It makes it easy to highlight all the area and let you specify different styles depending on the state of the zone: normal, hover, active, disable.
You can also specify how many zones can be selected at the same time.
The following code may help you:
$("#svgEuropa [id='stallwanger.it.dev_shape_DEU']").on("click",function(){
alert($(this).attr("id"));
});
Source
You have quite a few options for this:
1 - If you can find an SVG file for the map you want, you can use something like RaphaelJS or SnapSVG to add click listeners for your states/regions, this solution is the most customizable...
2 - You can use dedicated tools such as clickablemapbuilder (free) or makeaclickablemap (i think free also).
[disclaimer] Im the author of clickablemapbuilder.com :)
<script type="text/javascript">
jQuery(function($){
$('#map-country').cssMap({'size' : 810});
});
</script>
strong text
In Liferay I have used the asset publisher to publish news on my news page. I want to fetch the 3 top news from the page and embed it into another page. How can I do this? The page URL containing the news links looks like the following:
Liferay.Widget({ url: 'http://test.com/testnews/101_INSTANCE_f22'});
Liferay itself has a property where one can share an asset publsiher instance any where else on a site, but that is not exactly what I want. So any help or guidance is appreciated. Thanks.
If you want only links then you can set display style 'title-list' (this will take you to the article on the main news page).
if you want to open the link in another page, change asset link behavior to 'View in a specific portlet'.
You can change the look of asset publisher to whatever design you want. follow the path look & feel --> advanced styling --> Copy the portlet id. Now by using mozilla firefox pick the class,tags,etc. and write your css code. This will override the basic design. E.g.
#p_p_id_101_INSTANCE_8f5JPIxv8ml0_ .asset-abstract {
width: 25%;
float: left;
}
Is there a particular reason why you don't want to configure another AssetPublisher on the second page? You can just use the identical configuration, but limit the number of results shown to 3 - done.
Problem solved. Here is the solution with jQuery:
$.get('http://test.com/news/', function(data) {
var top3links = $(data).find('a:lt(3)');
$('#top3').html(top3links); // });