Skip to content

Commit

Permalink
Updated Opinary embed modal
Browse files Browse the repository at this point in the history
Issue #367
- Updated Opinary embed modal to fuction similar to social and video
embed modals. Provides URL validation, embed preview, and URL
duplication checks.
- Added `.social_editor-blocker` style to provide element to prevent
embed interaction to `.social_editor-preview` as needed.
- Fixed social embeds validation error messages to refer to the correct
service, not just Facebook.
  • Loading branch information
rpeterman-gp committed Jun 26, 2017
1 parent 553e49f commit acdb824
Show file tree
Hide file tree
Showing 12 changed files with 326 additions and 57 deletions.
4 changes: 3 additions & 1 deletion src/contents/less/embed-containers.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@

@import "priEmbeds/twitterEmbed.less";

@import "priEmbeds/slideshow.less";
@import "priEmbeds/slideshow.less";

@import "priEmbeds/opinaryEmbed.less";
4 changes: 4 additions & 0 deletions src/contents/less/priEmbeds/opinaryEmbed.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.opinary-widget
{
background-color: @body-bg;
}
4 changes: 3 additions & 1 deletion src/contents/less/priEmbeds/priEntityEmbeds.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@

@import "twitterEmbed.less";

@import "slideshow.less";
@import "slideshow.less";

@import "opinaryEmbed.less";
12 changes: 12 additions & 0 deletions src/contents/less/social_editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@

.social_editor-preview_inner
{
position: relative;

> * {
& + * {
margin-left: 20px;
Expand Down Expand Up @@ -152,4 +154,14 @@
color: @btn-primary-color;
text-decoration: none;
}
}

.social_editor-blocker
{
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
}
37 changes: 36 additions & 1 deletion src/html/modal/modal_opinary.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,42 @@
<div class="embed-modal-full-column">
<div class="embed-modal-form">
<label class="embed-modal-label" for="url">Source</label>
<input name="url" type="url" placeholder="Enter the Opinary URL" class="embed-modal-form-control" />

<div class="social_editor">

<div class="social_editor-intro">
<div class="social_editor-intro_inner">
<div>
<div class="input-group">
<input name="url" type="url" placeholder="Enter URL, or drop link..." class="embed-modal-input embed-modal-form-control js-input-url" />
<span class="input-group-btn">
<button class="btn btn-primary js-btn-preview" type="button">Preview</button>
</span>
</div>
</div>
</div>
</div>

<div class="social_editor-preview">
<div class="social_editor-preview_inner">
<div class="social_editor-preview_post"></div>
<div class="social_editor-blocker"></div>
</div>
</div>

<div class="social_editor-toolbar">
<ul class="social_editor-toolbar_list">
<li class="social_editor-toolbar_item js-btn-edit">
<a class="social_editor-tollbar_btn"><span class="fa fa-pencil" aria-label="Enter Another URL"></span></a>
</li>
<li class="social_editor-toolbar_item js-btn-cancel">
<a class="social_editor-tollbar_btn"><span class="fa fa-arrow-left" aria-label="Cancel URL Editing"></span></a>
</li>
</ul>
</div>

</div>

</div>
</div>
</div>
Expand Down
88 changes: 44 additions & 44 deletions src/html/modal/modal_twitter.html
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
<form>
<div class="embed-modal-row">
<div class="embed-modal-full-column">
<div class="embed-modal-form">
<label class="embed-modal-label" for="title">Title</label>
<input name="title" type="text" placeholder="Enter a title" class="embed-modal-input embed-modal-form-control js-input-title" />
</div>
</div>
</div>
<div class="embed-modal-row">
<div class="embed-modal-full-column">
<div class="embed-modal-form">
<label class="embed-modal-label" for="url">Twitter Status (Tweet)</label>
<div class="embed-modal-row">
<div class="embed-modal-full-column">
<div class="embed-modal-form">
<label class="embed-modal-label" for="title">Title</label>
<input name="title" type="text" placeholder="Enter a title" class="embed-modal-input embed-modal-form-control js-input-title" />
</div>
</div>
</div>
<div class="embed-modal-row">
<div class="embed-modal-full-column">
<div class="embed-modal-form">
<label class="embed-modal-label" for="url">Twitter Status (Tweet)</label>

<div class="social_editor">
<div class="social_editor">

<div class="social_editor-intro">
<div class="social_editor-intro_inner">
<div>
<div class="input-group">
<input name="url" type="url" placeholder="Enter URL, or drop link..." class="embed-modal-input embed-modal-form-control js-input-url" />
<span class="input-group-btn">
<button class="btn btn-primary js-btn-preview" type="button">Preview</button>
</span>
</div>
</div>
</div>
</div>
<div class="social_editor-intro">
<div class="social_editor-intro_inner">
<div>
<div class="input-group">
<input name="url" type="url" placeholder="Enter URL, or drop link..." class="embed-modal-input embed-modal-form-control js-input-url" />
<span class="input-group-btn">
<button class="btn btn-primary js-btn-preview" type="button">Preview</button>
</span>
</div>
</div>
</div>
</div>

<div class="social_editor-preview">
<div class="social_editor-preview_inner">
<div class="social_editor-preview_post"></div>
</div>
</div>
<div class="social_editor-preview">
<div class="social_editor-preview_inner">
<div class="social_editor-preview_post"></div>
</div>
</div>

<div class="social_editor-toolbar">
<ul class="social_editor-toolbar_list">
<li class="social_editor-toolbar_item js-btn-edit">
<a class="social_editor-tollbar_btn"><span class="fa fa-pencil" aria-label="Enter Another URL"></span></a>
</li>
<li class="social_editor-toolbar_item js-btn-cancel">
<a class="social_editor-tollbar_btn"><span class="fa fa-arrow-left" aria-label="Cancel URL Editing"></span></a>
</li>
</ul>
</div>
<div class="social_editor-toolbar">
<ul class="social_editor-toolbar_list">
<li class="social_editor-toolbar_item js-btn-edit">
<a class="social_editor-tollbar_btn"><span class="fa fa-pencil" aria-label="Enter Another URL"></span></a>
</li>
<li class="social_editor-toolbar_item js-btn-cancel">
<a class="social_editor-tollbar_btn"><span class="fa fa-arrow-left" aria-label="Cancel URL Editing"></span></a>
</li>
</ul>
</div>

</div>
</div>

</div>
</div>
</div>
</div>
</div>
</div>
</form>
2 changes: 1 addition & 1 deletion src/js/embeds/facebookEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ var EntityEmbed = EntityEmbed || {};
}
else
{
// Get Video embeds that have matching URL
// Get Facebook embeds that have matching URL
EntityEmbed.apiService.get({
path: self.options.httpPaths.getAll,
data: {
Expand Down
4 changes: 2 additions & 2 deletions src/js/embeds/instagramEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ var EntityEmbed = EntityEmbed || {};
$.validator.addMethod('validInstagramUrl', function(value, element, params) {
var isValid = isValidUrl(value);
return this.optional(element) || isValid;
}, 'The URL must be to a valid Facebook post or video.');
}, 'The URL must be to a valid Instagram post.');

$ui.previewBtn.on('click', function(evt) {

Expand Down Expand Up @@ -320,7 +320,7 @@ var EntityEmbed = EntityEmbed || {};
}
else
{
// Get Video embeds that have matching URL
// Get Instagram embeds that have matching URL
EntityEmbed.apiService.get({
path: self.options.httpPaths.getAll,
data: {
Expand Down
Loading

0 comments on commit acdb824

Please sign in to comment.