Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Move js code to files in media action plugins #137

Merged
merged 1 commit into from
Apr 1, 2017

Conversation

laoneo
Copy link
Contributor

@laoneo laoneo commented Apr 1, 2017

Pull Request for Issue #126.

Summary of Changes

Moves the js code from the layouts to js files. Additionally the lib files are stored locally with a minified and a dev version.

@laoneo laoneo added this to the Milestone 1 milestone Apr 1, 2017
@laoneo laoneo self-assigned this Apr 1, 2017
@laoneo laoneo added this to Pull Requests in Edit view with media action plugins Apr 1, 2017
Copy link
Contributor

@dgrammatiko dgrammatiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the simplicity here

@@ -13,8 +13,8 @@
JHtml::_('jquery.framework');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should remove that line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still needed because the edit.js file is jQuery dependent. If somebody with more knowledge can fix that, would be nice to remove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what the heck is edit.js?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok replace the code with:

(function() {
  "use strict";
	document.addEventListener('DOMContentLoaded', function() {
		var list = document.querySelectorAll('a[data-toggle="tab"]');

		list.forEach(function(item) {
			item.addEventListener('shown.bs.tab', function(event) {
				if (event.relatedTarget) {
					EventBus.dispatch('onDeactivate', this, event.relatedTarget.hash.replace('#attrib-', ''), document.getElementById('media-edit-file'));
				}
				EventBus.dispatch('onActivate', this, event.target.hash.replace('#attrib-', ''), document.getElementById('media-edit-file'));
			})
		})
	});
})();

@laoneo
Copy link
Contributor Author

laoneo commented Apr 1, 2017

Hopefully it will make it easier for the JS cracks to work on the media action plugins 😉

@dgrammatiko dgrammatiko merged commit 7e23342 into milestone1 Apr 1, 2017
@dgrammatiko dgrammatiko deleted the edit-view/scripts branch April 1, 2017 20:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

2 participants