-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drag and drop added for images in the sidebar #645
Conversation
app/controllers/images_controller.rb
Outdated
@@ -98,6 +99,12 @@ def update | |||
render text: 'success' | |||
end | |||
|
|||
def sort | |||
params[:warpable].each_with_index do |id, index| | |||
@warpable.where(id: id).update_all(position: index+1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator +
.
Code Climate has analyzed commit dd041d6 and detected 1 issue on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Codecov Report
@@ Coverage Diff @@
## main #645 +/- ##
==========================================
- Coverage 71.27% 71.15% -0.13%
==========================================
Files 32 32
Lines 1288 1293 +5
==========================================
+ Hits 918 920 +2
- Misses 370 373 +3
|
I tried to add the column Can you please help me out @gauravano @jywarren ? |
Hmm, I'm not sure about that error, but maybe googling for the exact phrase
with the word "field" especially could help -- it doesn't look like the
typical "that column doesn't exist" type error.
I was wondering if we could think through what would happen if a warpable
belonged to multiple maps. How could we track position? Would we put the
position field in the join table, something like image_to_map.position, so
each map could have a different ordering? Or what other ideas do you have?
Thanks!!!
…On Tue, May 28, 2019, 9:28 AM Divya Baid ***@***.***> wrote:
I tried to add the column position in Warpables but I'm getting the
following error:
[image: Selection_163]
<https://user-images.githubusercontent.com/32747809/58481634-6743ca80-817a-11e9-9120-eabb2b7ceb0f.png>
Can you please help me out @gauravano <https://github.com/gauravano>
@jywarren <https://github.com/jywarren> ?
Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#645?email_source=notifications&email_token=AAAF6J4LRH7JDWYGZCGKIMLPXUXO5A5CNFSM4HQBAM3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWMDZUA#issuecomment-496516304>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAF6J7SOGYSZHUE34JR3ODPXUXO5ANCNFSM4HQBAM3A>
.
|
Here, after drag and drop of the table rows, I tried to get the order in which they are present now,
And, after getting the parameters, I updated the And regarding, warpable belonging to multiple map, I think while doing this, id of the particular map was recorded and changes was made only to the images in that map. Thanks! |
My error for this comment is solved. I had cleaned all the tables and migrated it once again. Thanks for your help @jywarren ! |
I guess this is a separate discussion then, about
images-belonging-to-many-maps, but if we did do this, i think it may be
worth putting the position in the join table, or each time reordering
happens, it could rearrange other maps too!
See here for reference -- does this make sense?
https://guides.rubyonrails.org/association_basics.html#the-has-and-belongs-to-many-association
Thanks!
…On Tue, May 28, 2019 at 10:11 AM Divya Baid ***@***.***> wrote:
My error for this comment
<#645 (comment)>
is solved.
I had cleaned all the tables and migrated it once again.
Thanks for your help @jywarren <https://github.com/jywarren> !
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#645?email_source=notifications&email_token=AAAF6JZRGQOCI6GATA3L6DDPXU4N5A5CNFSM4HQBAM3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWMIACI#issuecomment-496533513>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAF6JYOMEDK5A24CSTQACDPXU4N5ANCNFSM4HQBAM3A>
.
|
I got your point @jywarren , I will try it now. |
Hi @jywarren @gauravano @sashadev-sky Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@divyabaid16 I made a commit suggestion that resolves the problem! And this is done client side so it won't effect other maps.
My commit suggestion also still works if you delete the update to the
and in the images_controller can delete:
Although i'm wondering about the |
Oh, I guess I had added that lines to feed_controller by mistake. Thanks! |
Thank you @sashadev-sky for your changes suggested :) @jywarren @gauravano can you please review this now? Thanks! |
The test is failing because of too many lines in image_controller. |
@divyabaid16 try rebasing and testing it - because its throwing a server error for me now! |
I have created a new pull request #670 |
Fixes #644 (<=== Add issue number here)
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
@publiclab/reviewers
for help, in a comment belowGIF For the same:
Thanks!