forked from OpenNeo/impress
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) {
|
||||
var link = $('#report-broken-image');
|
||||
var baseURL = link.attr('data-base-url');
|
||||
View.AssetLinks = function (wardrobe) {
|
||||
var links = $('#swf-links, #report-broken-image');
|
||||
|
||||
function updateLink() {
|
||||
var assets = wardrobe.outfits.getVisibleAssets();
|
||||
var url = baseURL + "?";
|
||||
links.each(function() {
|
||||
var link = $(this);
|
||||
var assets = wardrobe.outfits.getVisibleAssets();
|
||||
var url = link.attr('data-base-url') + "?";
|
||||
|
||||
for(var i = 0; i < assets.length; i++) {
|
||||
if(i > 0) url += "&";
|
||||
url += "asset_ids[" + assets[i].type + "][]=" + assets[i].id;
|
||||
}
|
||||
for(var i = 0; i < assets.length; i++) {
|
||||
if(i > 0) url += "&";
|
||||
url += "asset_ids[" + assets[i].type + "][]=" + assets[i].id;
|
||||
}
|
||||
|
||||
link.attr('href', url);
|
||||
link.attr('href', url);
|
||||
});
|
||||
}
|
||||
|
||||
wardrobe.outfits.bind('updateWornItems', updateLink);
|
||||
|
|
|
@ -28,4 +28,5 @@
|
|||
@import static/donate
|
||||
@import static/image_mode
|
||||
@import static/terms
|
||||
@import swf_assets/links
|
||||
@import users/top_contributors
|
||||
|
|
|
@ -1,26 +1,12 @@
|
|||
@import partials/assets-list
|
||||
|
||||
body.broken_image_reports-new
|
||||
|
||||
#report-assets
|
||||
li
|
||||
+border-radius(.5em)
|
||||
+inline-block
|
||||
border: 1px solid $soft-border-color
|
||||
margin: .5em
|
||||
padding: .5em
|
||||
text-align: center
|
||||
vertical-align: top
|
||||
width: 150px
|
||||
+assets-list
|
||||
|
||||
img, span, input
|
||||
display: block
|
||||
width: 100%
|
||||
|
||||
img
|
||||
height: 150px
|
||||
width: 150px
|
||||
|
||||
span
|
||||
font-size: 85%
|
||||
span
|
||||
font-size: 85%
|
||||
|
||||
.manual a
|
||||
display: block
|
||||
|
|
|
@ -168,17 +168,19 @@ body.outfits-edit
|
|||
button
|
||||
font-size: 75%
|
||||
width: 100%
|
||||
#preview-mode a
|
||||
font-size: 75%
|
||||
margin-top: .5em
|
||||
text-align: center
|
||||
text-decoration: none
|
||||
width: 100%
|
||||
em
|
||||
font-style: normal
|
||||
text-decoration: underline
|
||||
#preview-mode-note, #report-broken-image
|
||||
display: none
|
||||
#preview-mode
|
||||
a
|
||||
display: block
|
||||
font-size: 75%
|
||||
margin-top: .5em
|
||||
text-align: center
|
||||
text-decoration: none
|
||||
width: 100%
|
||||
em
|
||||
font-style: normal
|
||||
text-decoration: underline
|
||||
#report-broken-image
|
||||
display: none
|
||||
|
||||
#preview-sidebar
|
||||
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
|
||||
def new
|
||||
ids = params[:asset_ids]
|
||||
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'))
|
||||
))
|
||||
@swf_assets = SwfAsset.from_wardrobe_link_params(params[:asset_ids]).where(:has_image => true)
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -60,5 +60,9 @@ class SwfAssetsController < ApplicationController
|
|||
@swf_asset = SwfAsset.find params[:id]
|
||||
render :json => @swf_asset
|
||||
end
|
||||
|
||||
def links
|
||||
@swf_assets = SwfAsset.from_wardrobe_link_params(params[:asset_ids])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -237,6 +237,14 @@ class SwfAsset < ActiveRecord::Base
|
|||
self.url = "#{NEOPETS_ASSET_SERVER}/#{data['url']}"
|
||||
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
|
||||
uri = URI.parse url
|
||||
begin
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
= link_to t('.preview.big_picture'), 'javascript:void(0)',
|
||||
id: 'toggle-big-picture'
|
||||
= 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)',
|
||||
:id => 'report-broken-image', :target => '_blank', 'data-base-url' => new_broken_image_report_path
|
||||
#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.
|
||||
big_picture: Big Picture
|
||||
download: Download
|
||||
swf_links: SWF Links
|
||||
mode:
|
||||
flash:
|
||||
name: Flash
|
||||
|
@ -816,6 +817,10 @@ en:
|
|||
Please try again later!
|
||||
neopia_error: "We couldn't load that pet: \"%{message}\". Try again later?"
|
||||
|
||||
swf_assets:
|
||||
links:
|
||||
title: Links to SWFs
|
||||
|
||||
users:
|
||||
index:
|
||||
not_found: We don't have a user named %{name}. Is it spelled correctly?
|
||||
|
|
|
@ -32,7 +32,11 @@ OpenneoImpressItems::Application.routes.draw do
|
|||
end
|
||||
resources :outfits, :only => [:show, :create, :update, :destroy]
|
||||
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]
|
||||
|
||||
scope 'import' do
|
||||
|
|
Loading…
Reference in a new issue