swf links
This commit is contained in:
parent
bf9f9ed82e
commit
b0cc4c2396
13 changed files with 92 additions and 48 deletions
|
@ -1090,20 +1090,22 @@ View.PreviewAdapterForm = function (wardrobe) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
View.ReportBrokenImage = function (wardrobe) {
|
View.AssetLinks = function (wardrobe) {
|
||||||
var link = $('#report-broken-image');
|
var links = $('#swf-links, #report-broken-image');
|
||||||
var baseURL = link.attr('data-base-url');
|
|
||||||
|
|
||||||
function updateLink() {
|
function updateLink() {
|
||||||
var assets = wardrobe.outfits.getVisibleAssets();
|
links.each(function() {
|
||||||
var url = baseURL + "?";
|
var link = $(this);
|
||||||
|
var assets = wardrobe.outfits.getVisibleAssets();
|
||||||
|
var url = link.attr('data-base-url') + "?";
|
||||||
|
|
||||||
for(var i = 0; i < assets.length; i++) {
|
for(var i = 0; i < assets.length; i++) {
|
||||||
if(i > 0) url += "&";
|
if(i > 0) url += "&";
|
||||||
url += "asset_ids[" + assets[i].type + "][]=" + assets[i].id;
|
url += "asset_ids[" + assets[i].type + "][]=" + assets[i].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
link.attr('href', url);
|
link.attr('href', url);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
wardrobe.outfits.bind('updateWornItems', updateLink);
|
wardrobe.outfits.bind('updateWornItems', updateLink);
|
||||||
|
|
|
@ -28,4 +28,5 @@
|
||||||
@import static/donate
|
@import static/donate
|
||||||
@import static/image_mode
|
@import static/image_mode
|
||||||
@import static/terms
|
@import static/terms
|
||||||
|
@import swf_assets/links
|
||||||
@import users/top_contributors
|
@import users/top_contributors
|
||||||
|
|
|
@ -1,26 +1,12 @@
|
||||||
|
@import partials/assets-list
|
||||||
|
|
||||||
body.broken_image_reports-new
|
body.broken_image_reports-new
|
||||||
|
|
||||||
#report-assets
|
#report-assets
|
||||||
li
|
+assets-list
|
||||||
+border-radius(.5em)
|
|
||||||
+inline-block
|
|
||||||
border: 1px solid $soft-border-color
|
|
||||||
margin: .5em
|
|
||||||
padding: .5em
|
|
||||||
text-align: center
|
|
||||||
vertical-align: top
|
|
||||||
width: 150px
|
|
||||||
|
|
||||||
img, span, input
|
span
|
||||||
display: block
|
font-size: 85%
|
||||||
width: 100%
|
|
||||||
|
|
||||||
img
|
|
||||||
height: 150px
|
|
||||||
width: 150px
|
|
||||||
|
|
||||||
span
|
|
||||||
font-size: 85%
|
|
||||||
|
|
||||||
.manual a
|
.manual a
|
||||||
display: block
|
display: block
|
||||||
|
|
|
@ -168,17 +168,19 @@ body.outfits-edit
|
||||||
button
|
button
|
||||||
font-size: 75%
|
font-size: 75%
|
||||||
width: 100%
|
width: 100%
|
||||||
#preview-mode a
|
#preview-mode
|
||||||
font-size: 75%
|
a
|
||||||
margin-top: .5em
|
display: block
|
||||||
text-align: center
|
font-size: 75%
|
||||||
text-decoration: none
|
margin-top: .5em
|
||||||
width: 100%
|
text-align: center
|
||||||
em
|
text-decoration: none
|
||||||
font-style: normal
|
width: 100%
|
||||||
text-decoration: underline
|
em
|
||||||
#preview-mode-note, #report-broken-image
|
font-style: normal
|
||||||
display: none
|
text-decoration: underline
|
||||||
|
#report-broken-image
|
||||||
|
display: none
|
||||||
|
|
||||||
#preview-sidebar
|
#preview-sidebar
|
||||||
float: left
|
float: left
|
||||||
|
|
18
app/assets/stylesheets/partials/_assets-list.sass
Normal file
18
app/assets/stylesheets/partials/_assets-list.sass
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
=assets-list
|
||||||
|
li
|
||||||
|
+border-radius(.5em)
|
||||||
|
+inline-block
|
||||||
|
border: 1px solid $soft-border-color
|
||||||
|
margin: .5em
|
||||||
|
padding: .5em
|
||||||
|
text-align: center
|
||||||
|
vertical-align: top
|
||||||
|
width: 150px
|
||||||
|
|
||||||
|
img, span, input
|
||||||
|
display: block
|
||||||
|
width: 100%
|
||||||
|
|
||||||
|
img
|
||||||
|
height: 150px
|
||||||
|
width: 150px
|
10
app/assets/stylesheets/swf_assets/_links.sass
Normal file
10
app/assets/stylesheets/swf_assets/_links.sass
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
@import partials/assets-list
|
||||||
|
|
||||||
|
body.swf_assets-links
|
||||||
|
#swf-assets
|
||||||
|
+assets-list
|
||||||
|
|
||||||
|
li
|
||||||
|
span
|
||||||
|
font-size: 75%
|
||||||
|
word-wrap: break-word
|
|
@ -1,12 +1,6 @@
|
||||||
class BrokenImageReportsController < ApplicationController
|
class BrokenImageReportsController < ApplicationController
|
||||||
def new
|
def new
|
||||||
ids = params[:asset_ids]
|
@swf_assets = SwfAsset.from_wardrobe_link_params(params[:asset_ids]).where(:has_image => true)
|
||||||
assets = SwfAsset.arel_table
|
|
||||||
@swf_assets = SwfAsset.where(:has_image => true).where((
|
|
||||||
assets[:remote_id].in(ids[:biology]).and(assets[:type].eq('biology'))
|
|
||||||
).or(
|
|
||||||
assets[:remote_id].in(ids[:object]).and(assets[:type].eq('object'))
|
|
||||||
))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
|
@ -60,5 +60,9 @@ class SwfAssetsController < ApplicationController
|
||||||
@swf_asset = SwfAsset.find params[:id]
|
@swf_asset = SwfAsset.find params[:id]
|
||||||
render :json => @swf_asset
|
render :json => @swf_asset
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def links
|
||||||
|
@swf_assets = SwfAsset.from_wardrobe_link_params(params[:asset_ids])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,14 @@ class SwfAsset < ActiveRecord::Base
|
||||||
self.url = "#{NEOPETS_ASSET_SERVER}/#{data['url']}"
|
self.url = "#{NEOPETS_ASSET_SERVER}/#{data['url']}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.from_wardrobe_link_params(ids)
|
||||||
|
where((
|
||||||
|
arel_table[:remote_id].in(ids[:biology]).and(arel_table[:type].eq('biology'))
|
||||||
|
).or(
|
||||||
|
arel_table[:remote_id].in(ids[:object]).and(arel_table[:type].eq('object'))
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
before_create do
|
before_create do
|
||||||
uri = URI.parse url
|
uri = URI.parse url
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
= link_to t('.preview.big_picture'), 'javascript:void(0)',
|
= link_to t('.preview.big_picture'), 'javascript:void(0)',
|
||||||
id: 'toggle-big-picture'
|
id: 'toggle-big-picture'
|
||||||
= link_to t('.preview.download'), 'javascript:void(0)', id: 'preview-mode-download'
|
= link_to t('.preview.download'), 'javascript:void(0)', id: 'preview-mode-download'
|
||||||
|
= link_to t('.preview.swf_links'), 'javascript:void(0)', id: 'swf-links',
|
||||||
|
target: '_blank', 'data-base-url' => links_swf_assets_path
|
||||||
= link_to t('.preview.mode.image.report_broken'), 'javascript:void(0)',
|
= link_to t('.preview.mode.image.report_broken'), 'javascript:void(0)',
|
||||||
:id => 'report-broken-image', :target => '_blank', 'data-base-url' => new_broken_image_report_path
|
:id => 'report-broken-image', :target => '_blank', 'data-base-url' => new_broken_image_report_path
|
||||||
#preview-sidebar
|
#preview-sidebar
|
||||||
|
|
8
app/views/swf_assets/links.html.haml
Normal file
8
app/views/swf_assets/links.html.haml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
- title t('.title')
|
||||||
|
|
||||||
|
%ul#swf-assets
|
||||||
|
- @swf_assets.each do |swf_asset|
|
||||||
|
%li
|
||||||
|
= link_to swf_asset.url do
|
||||||
|
= image_tag(swf_asset.image_url([150, 150]))
|
||||||
|
%span= swf_asset.url
|
|
@ -564,6 +564,7 @@ en:
|
||||||
Flash and Javascript (but not Java!) are required to preview outfits.
|
Flash and Javascript (but not Java!) are required to preview outfits.
|
||||||
big_picture: Big Picture
|
big_picture: Big Picture
|
||||||
download: Download
|
download: Download
|
||||||
|
swf_links: SWF Links
|
||||||
mode:
|
mode:
|
||||||
flash:
|
flash:
|
||||||
name: Flash
|
name: Flash
|
||||||
|
@ -816,6 +817,10 @@ en:
|
||||||
Please try again later!
|
Please try again later!
|
||||||
neopia_error: "We couldn't load that pet: \"%{message}\". Try again later?"
|
neopia_error: "We couldn't load that pet: \"%{message}\". Try again later?"
|
||||||
|
|
||||||
|
swf_assets:
|
||||||
|
links:
|
||||||
|
title: Links to SWFs
|
||||||
|
|
||||||
users:
|
users:
|
||||||
index:
|
index:
|
||||||
not_found: We don't have a user named %{name}. Is it spelled correctly?
|
not_found: We don't have a user named %{name}. Is it spelled correctly?
|
||||||
|
|
|
@ -32,7 +32,11 @@ OpenneoImpressItems::Application.routes.draw do
|
||||||
end
|
end
|
||||||
resources :outfits, :only => [:show, :create, :update, :destroy]
|
resources :outfits, :only => [:show, :create, :update, :destroy]
|
||||||
resources :pet_attributes, :only => [:index]
|
resources :pet_attributes, :only => [:index]
|
||||||
resources :swf_assets, :only => [:index, :show]
|
resources :swf_assets, :only => [:index, :show] do
|
||||||
|
collection do
|
||||||
|
get :links
|
||||||
|
end
|
||||||
|
end
|
||||||
resources :zones, only: [:index]
|
resources :zones, only: [:index]
|
||||||
|
|
||||||
scope 'import' do
|
scope 'import' do
|
||||||
|
|
Loading…
Reference in a new issue